For details about Docker Rootless check this blog post or this slideshare
We'll be setting up an environment and do a demo of how docker rootless mode works.
We'll use Vagrant and VirtualBox to get a clean OS that can be run on any other OS.
First clone this repo locally and enter inside the checked out repo on CLI. The rest of commands are to be executed there.
There are two VMs rootless and rootful that can be started with the following command:
vagrant upBoth are clean Ubuntu OS Xenial64.
To install Docker rootless mode normally the following should be used:
vagrant ssh rootless
# Install Dependencies
/vagrant/scripts/setup.sh
# Install Docker rootless
curl -sSL https://get.docker.com/rootless | shSame script pointing to release v19.03.1 is located locally:
/vagrant/scripts/rootless.shvagrant ssh rootful
curl -fsSL https://get.docker.com -o get-docker.shOn one console run docker daemon:
export PATH=/home/vagrant/bin:$PATH
export DOCKER_HOST=unix:///run/user/1000/docker.sockOn another console connect to the daemon:
export PATH=/home/vagrant/bin:$PATH
export DOCKER_HOST=unix:///run/user/1000/docker.sock
docker run hello-worldThe demo script can be run on both VMs so you can see the differences
ubuntu user is not part of docker group, so it needs sudo to access the docker socket:
# On rootful VM
sudo su - ubuntu
docker ps
sudo docker psvagrant user is part of docker group and can access docker socket directly:
# On rootful VM
docker psdocker run hello-worldOverlays are stored in different locations:
ls -al ~/.local/share/docker/overlay
sudo ls -al /var/lib/docker/overlay2Expose a port of range 1000+
docker run nginx -d -p 32768:80 nginx:alpine
curl localhost:32768
docker rm -f nginxExpose a port of range 1000-
docker run --name nginx -d -p 80:80 nginx:alpine
docker rm -f nginx