non-root user on the host.root, even if the app inside the container does not.USER in Dockerfile
1
2
3
4
sudo apt-get update
sudo apt-get install -y uidmap docker-ce-rootless-extras
grep "^$USER:" /etc/subuid
grep "^$USER:" /etc/subgid
1
2
sudo systemctl disable --now docker.service docker.socket
sudo rm -f /var/run/docker.sock
1
2
3
4
dockerd-rootless-setuptool.sh install
systemctl --user start docker
sudo loginctl enable-linger $USER
export DOCKER_HOST=unix:///run/user/$(id -u)/docker.sock
1
2
3
docker info
docker context ls
docker run --rm hello-world
docker info should show security options including rootlesslatest is especially slippery.COPYed files,ENV,ARG..git,.env files,.dockerignore the same way you use __pycache__ cleanup in a tidy repo: DOCKER_CONTENT_TRUST=1 to only pull/run/build with signed tagged images.Fork from the following repository
USER.fabric-examples repo.root inside the container plus writable host paths.--cap-drop=ALL--security-opt no-new-privileges=true--read-onlytmpfs for only the required paths./ from the host,/var/run/docker.sock,127.0.0.1 when possible,/run/secrets/.....env files.--read-only this time?”read_only: truecap_drop:security_opt:tmpfs:secrets:user:ports: in the service definition.no-new-privileges.--privileged, host networking, and dangerous host mounts.