Web Proxy (PI)

Einführung

Erstellen eines Docker Images basierend auf Alpine und Privoxy.

Voraussetzung

  • Raspberry Pi mit Raspbian OS
  • Docker
  • Docker-Compose

Image erstellen

Schritt 1

Erstellung einer dockerfile Datei. Lädt alpine als Basis Image. Erstellt ein Verzeichnis ‚/apps‘, wechselt in das Verzeichnis und kopiert die Dateien aus dem lokalen Unterverzeichnis ’scripts‘ in das ‚/app‘ Verzeichnis.  Installation von ‚bash‘ und ‚privoxy‘. Aufruf des Start Scripts:

FROM alpine:latest
RUN mkdir /apps
WORKDIR /apps
COPY /scripts/ .
RUN apk add --no-cache bash privoxy \
    && echo "forward-socks5 / 192.168.178.31:9050 ." >> /etc/privoxy/config \
    && sed -i 's/listen-address\s*127.0.0.1:8118/listen-address :8118/g' /etc/privoxy/config
EXPOSE 8118/tcp
CMD ["sh", "-c", "/apps/entry.sh"] 

Die Datei ‚entry.sh‘:

#!/bin/sh
exec /usr/sbin/privoxy --no-daemon /etc/privoxy/config 2>&1 
Schritt 2

Ausführen des dockerfiles (Punkt am Ende nicht vergessen):

sudo docker build -f name_dockerfile – t name_image:nummer .

Prüfen ob Image vorhanden ist:

sudo docker images

Docker-compose (’network‘ nur nötig falls proxy verwendet wird):

version: "3"
services:
  privoxy:
    image: privoxy
    restart: always
    ports:
      - "8118:8118" # Privoxy

networks:
  default:
    external:
      name: proxy
# proxy network needs to be defined before if not done
# docker network create proxy 
Container starten:
sudo docker-compose -f name_docker_compose_file up -d

Prüfen ob Privoxy läuft:

http://192.168.178.31:8118/

Privoxy Config prüfen:

http://config.privoxy.org/show-status