Run Container as non root user
- Lingua principale
- Go
- Stelle
- 1.2k
- Fork
- 69
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
**Is your feature request related to a problem? Please describe.**
For security concerns i would like to run the container as a non root user.
**Describe the solution you'd like**
Possibillity to provide a `GID` and `UID` enviroment variable for the docker container.
To still have access to the docker socket one could then use [docker-socket-proxy](https://github.com/Tecnativa/docker-socket-proxy) instead of using the socket directly.
It also would be beneficial to provide the host for the dockerproxy as a env variable to peekaping. For example one could set `DOCKERPROXY_HOST` and this gets then selected and pre-filled as the default option when creating docker monitors.
I have attached a example compose.yaml and .env file for it to work with the discussed env vars added (altough they dont do anything atm of course).
I really like the project so far, it looks really good and already has a ton of features!
compose.yaml
```yaml
services:
dockerproxy:
image: ghcr.io/tecnativa/docker-socket-proxy:latest
container_name: dockerproxy
env_file: .env
ports: []
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
restart: unless-stopped
networks:
- internal
peekaping-bundle:
image: 0xfurai/peekaping-bundle-postgres:latest
container_name: peekaping
restart: unless-stopped
ports:
- 8383:8383
env_file: .env
volumes:
- ./data/postgres:/var/lib/postgresql/data
networks:
- internal
depends_on:
- dockerproxy
networks:
internal: {}
```
.env
```.env
## Docker Proxy
CONTAINERS=1
SERVICES=1
TASKS=1
POST=0
## DB
DB_NAME=peekaping
DB_USER=peekaping
DB_PASS=secure_test_password_123
## General
GID=1000
UID=1000
TZ="Europe/Berlin"
DOCKERPROXY_HOST="http://dockerproxy:2375"
```
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Look at the Dockerfile and entrypoint scripts to see how the container currently runs. Identify where user/group IDs are set and where the Docker socket is accessed. The change involves modifying the container to accept GID and UID environment variables and adjusting the configuration to optionally use a docker-socket-proxy host. Check the code that creates Docker monitors to pre-fill the DOCKERPROXY_HOST. Test by building the image with the new environment variables and verifying it runs as a non-root user.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- docker, docker-compose, go
- Ambito
- devops, security
- Tipo di issue
- Funzionalità
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100