|
| 1 | + |
| 2 | + |
| 3 | +# ⛰️ socket-proxy |
| 4 | +[<img src="https://img.shields.io/badge/github-source-blue?logo=github&color=040308">](https://github.com/11notes/docker-socket-proxy)[<img src="https://img.shields.io/github/issues/11notes/docker-socket-proxy?color=7842f5">](https://github.com/11notes/docker-socket-proxy/issues) |
| 5 | + |
| 6 | +Access your docker socket safely as read-only |
| 7 | + |
| 8 | +# MAIN TAGS 🏷️ |
| 9 | +These are the main tags for the image. There is also a tag for each commit and its shorthand sha256 value. |
| 10 | + |
| 11 | +* [1.0.0](https://hub.docker.com/r/11notes/socket-proxy/tags?name=1.0.0) |
| 12 | +* [stable](https://hub.docker.com/r/11notes/socket-proxy/tags?name=stable) |
| 13 | +* [latest](https://hub.docker.com/r/11notes/socket-proxy/tags?name=latest) |
| 14 | + |
| 15 | +# SYNOPSIS 📖 |
| 16 | +**What can I do with this?** This image will run a proxy to access your docker socket read-only. The exposed proxy socket is run as 1000:1000, not as root, although the image starts the proxy process as root to interact with the actual docker socket as root. There is also a TCP endpoint started at 8080 that will also proxy to the actual docker socket if needed. |
| 17 | + |
| 18 | +# COMPOSE ✂️ |
| 19 | +```yaml |
| 20 | +name: "socket-proxy" |
| 21 | +services: |
| 22 | + socket-proxy: |
| 23 | + image: "11notes/socket-proxy:1.0.0" |
| 24 | + network_mode: "none" # removes all network capabillities from the container |
| 25 | + volumes: |
| 26 | + - "/run/docker.sock:/run/docker.sock:ro" # mount host docker socket, the :ro does not mean read-only for the socket, just for the actual file |
| 27 | + - "socket-proxy:/socket-proxy/run" # this socket is run as 1000:1000, not as root! |
| 28 | + restart: "always" |
| 29 | + |
| 30 | + traefik: |
| 31 | + image: "11notes/traefik:3.2.0" |
| 32 | + depends_on: |
| 33 | + socket-proxy: |
| 34 | + condition: "service_healthy" |
| 35 | + restart: true |
| 36 | + command: |
| 37 | + - "--global.checkNewVersion=false" |
| 38 | + - "--global.sendAnonymousUsage=false" |
| 39 | + - "--api.dashboard=true" |
| 40 | + - "--api.insecure=true" |
| 41 | + - "--log.level=INFO" |
| 42 | + - "--log.format=json" |
| 43 | + - "--providers.docker.exposedByDefault=false" # use docker provider but do not expose by default |
| 44 | + - "--entrypoints.http.address=:80" |
| 45 | + - "--entrypoints.https.address=:443" |
| 46 | + - "--serversTransport.insecureSkipVerify=true" # do not verify downstream SSL certificates |
| 47 | + ports: |
| 48 | + - "80:80/tcp" |
| 49 | + - "443:443/tcp" |
| 50 | + - "8080:8080/tcp" |
| 51 | + networks: |
| 52 | + frontend: |
| 53 | + backend: |
| 54 | + volumes: |
| 55 | + - "socket-proxy:/var/run" |
| 56 | + sysctls: |
| 57 | + net.ipv4.ip_unprivileged_port_start: 80 |
| 58 | + restart: "always" |
| 59 | + |
| 60 | + nginx: |
| 61 | + image: "11notes/nginx:1.26.2" |
| 62 | + labels: |
| 63 | + - "traefik.enable=true" |
| 64 | + - "traefik.http.routers.default.priority=1" |
| 65 | + - "traefik.http.routers.default.rule=PathPrefix(`/`)" |
| 66 | + - "traefik.http.routers.default.entrypoints=http" |
| 67 | + - "traefik.http.routers.default.service=default" |
| 68 | + - "traefik.http.services.default.loadbalancer.server.port=8443" |
| 69 | + - "traefik.http.services.default.loadbalancer.server.scheme=https" # proxy from http to https since this image runs by default on https |
| 70 | + networks: |
| 71 | + backend: # allow container only to be accessed via traefik |
| 72 | + restart: "always" |
| 73 | + |
| 74 | +volumes: |
| 75 | + socket-proxy: |
| 76 | + |
| 77 | +networks: |
| 78 | + frontend: |
| 79 | + backend: |
| 80 | + internal: true |
| 81 | +``` |
| 82 | +
|
| 83 | +# DEFAULT SETTINGS 🗃️ |
| 84 | +| Parameter | Value | Description | |
| 85 | +| --- | --- | --- | |
| 86 | +| `user` | docker | user name | |
| 87 | +| `uid` | 1000 | [user identifier](https://en.wikipedia.org/wiki/User_identifier) | |
| 88 | +| `gid` | 1000 | [group identifier](https://en.wikipedia.org/wiki/Group_identifier) | |
| 89 | +| `home` | /socket-proxy | home directory of user docker | |
| 90 | + |
| 91 | +# ENVIRONMENT 📝 |
| 92 | +| Parameter | Value | Default | |
| 93 | +| --- | --- | --- | |
| 94 | +| `TZ` | [Time Zone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) | | |
| 95 | +| `DEBUG` | Will activate debug option for container image and app (if available) | | |
| 96 | +| `SOCKET_PROXY` | path to the socket used as a proxy | /socket-proxy$/run/docker.sock | |
| 97 | +| `SOCKET_PROXY_DOCKER_SOCKET` | path to the actual docker socket | /run/docker.sock | |
| 98 | + |
| 99 | +# SOURCE 💾 |
| 100 | +* [11notes/socket-proxy](https://github.com/11notes/docker-socket-proxy) |
| 101 | + |
| 102 | +# PARENT IMAGE 🏛️ |
| 103 | +* [11notes/alpine:stable](https://hub.docker.com/r/11notes/alpine) |
| 104 | + |
| 105 | +${{ content_built }} |
| 106 | + |
| 107 | +# GENERAL TIPS 📌 |
| 108 | +* Use a reverse proxy like Traefik, Nginx, HAproxy to terminate TLS and to protect your endpoints |
| 109 | +* Use Let’s Encrypt DNS-01 challenge to obtain valid SSL certificates for your services |
| 110 | + |
| 111 | +# ElevenNotes™️ |
| 112 | +This image is provided to you at your own risk. Always make backups before updating an image to a different version. Check the [releases](https://github.com/11notes/docker-socket-proxy/releases) for breaking changes. If you have any problems with using this image simply raise an [issue](https://github.com/11notes/docker-socket-proxy/issues), thanks. If you have a question or inputs please create a new [discussion](https://github.com/11notes/docker-socket-proxy/discussions) instead of an issue. You can find all my other repositories on [github](https://github.com/11notes?tab=repositories). |
| 113 | + |
| 114 | +*created 19.3.2025, 13:40:36 (CET)* |
0 commit comments