References
ASSUMPTIONS
- You have no docker as root installed
- You have no root access (Not even use apt install)
- You want to install rootless and systemd style docker and docker compose and all other plugins
- You have a Ubuntu system – Latest (or VM) with default kernel
- Your Ubuntu distribution is not cutdown version
Docker Root Installation Pre-Requisites
loginctl enable-linger rtcamp # It creates /run/user/$(id -u)
export XDG_RUNTIME_DIR=/run/user/$(id -u)
echo "export PATH=/home/rtcamp/bin:\$PATH" >> ~/.bashrc
echo "export DOCKER_HOST=unix:///run/user/\$(id -u)/docker.sock" >> ~/.bashrc
Docker Installation
curl -fsSL https://get.docker.com/rootless | sh
Installing docker compose
DOCKER_COMPOSE_VER=$(curl --silent https://api.github.com/repos/docker/compose/releases | jq -r '.[0].tag_name')
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker} # only for the script to run
mkdir -p $DOCKER_CONFIG/cli-plugins
curl -SL https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VER}/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose
chmod u+x $DOCKER_CONFIG/cli-plugins/docker-compose
It all works 🎉 !
But here are some common problems
Network slow
For this you can refer to https://docs.docker.com/engine/security/rootless/#network-is-slow
Using privileged ports aka <1024
#### Login to user having sudo access ####
cp -v /etc/sysctl.conf /tmp/sys.conf
echo "net.ipv4.ip_unprivileged_port_start=0" >> /tmp/sys.conf
sudo mv -v /tmp/sys.conf /etc/sysctl.conf
sudo sysctl --system
Leave a Reply
You must be logged in to post a comment.