Skip to content

Run Container as non root user #163

@SenpaiSimon

Description

@SenpaiSimon

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 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

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

## 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" 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions