Rootless Docker

Page content

My environment

  • Pop!_OS
  • $ uname -a
    Linux system76 5.11.0-7620-generic #21~1624379747~20.10~3abeff8-Ubuntu SMP Wed Jun 23 02:23:59 UTC  x86_64 x86_64 x86_64 GNU/Linux
    

Configure rootless Docker

https://docs.docker.com/engine/security/rootless/

$ dockerd-rootless-setuptool.sh install
[ERROR] Missing system requirements. Run the following commands to
[ERROR] install the requirements and run this tool again.

########## BEGIN ##########
sudo sh -eux <<EOF
# Install newuidmap & newgidmap binaries
apt-get install -y uidmap
EOF
########## END ##########

OK… Run the command above and try again.

$ dockerd-rootless-setuptool.sh install
// ---- snipp ----
+ systemctl --user enable docker.service
[INFO] Installed docker.service successfully.
[INFO] To control docker.service, run: `systemctl --user (start|stop|restart) docker.service`
[INFO] To run docker.service on system startup, run: `sudo loginctl enable-linger {{ your_user_name }}`

[INFO] Make sure the following environment variables are set (or add them to ~/.bashrc):

export PATH=/usr/bin:$PATH
export DOCKER_HOST=unix:///run/user/1000/docker.soc

Add the two lines in ~/.bashrc and source ~/.bashrc.

sudo loginctl enable-linger {{ your_user_name }}
systemctl disable docker 

Restart PC, and change the docker-context.

docker context use rootless

Now, I use rootless docker-context as default.