Run Container as non root user
- Langage dominant
- Go
- Étoiles
- 1.2k
- Forks
- 69
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
**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"
```
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- docker, docker-compose, go
- Domaine
- devops, security
- Type d'issue
- Fonctionnalité
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 45/100