07 Aug 2022
A few months back I went back to slackware and one of the things that I missed was docker. slackbuilds at that time was still on 14.2. Luckily, docker provides statically compiled binaries.
Head on over to docker's release page
and choose the version that we want. At the time of writing
docker-20.10.9.tgz was the latest.
$ cd ~/Downloads $ wget https://download.docker.com/linux/static/stable/x86_64/docker-20.10.9.tgz
I have a
~/Programs folder, where I put things that I don't install with a package manager.
So in there it went.
$ tar xvf docker-20.10.9.tgz $ mv docker ~/Programs
docker folder has the binaries we need.
$ cd ~/Programs/docker $ ls ./ containerd* containerd-shim-runc-v2* docker* docker-init* runc* ../ containerd-shim* ctr* dockerd* docker-proxy*
Now we need to add these binaries to our shell's path. I'm using zsh, so my
has something like
You can chuck that into your
~/.bashrc, if you're using bash.
The docker daemon requires root privileges to run. So we need to invoke it with
$ sudo dockerd
But this will always ask for our password each time. A tiny edit to the
can sort that out
$ sudo visudo
That will open up the sudoers file in
nano based on root's
$EDITOR variable. Go to the
end of the file and add
john ALL=NOPASSWD: /home/john/Programs/docker/dockerd
john with your username. Now running
sudo dockerd from our terminal would
launch the docker daemon. If we accidently close that terminal,
dockerd would also die.
Create a shell script called
start-tmux in your
~/bin folder. I'm assuming
$PATH. Put in this
#/bin/sh tmux new-session -d -s docker 'sudo dockerd'
Make it executable with
$ chmod +x ~/bin/start-docker
Now we can run it with
start-docker from our terminal. To attach to the docker session
in tmux, run
$ tmux a -t docker
Here's a quick cheat-sheet on tmux if you're new to it. It is a brilliant tool to familiarize, if you're spending a lot of time on the terminal.
There's one more step left if our user wants to run the
$ sudo groupadd docker $ sudo usermod -aG docker $USER
This creates a group called
docker and add then we add our user to it. Without this
our user gets a permission denied error.
To test if everything went well, run
$ docker run hello-world
And we should see something like this.
Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/
This is how I run docker and it may not be the best for most people. For example,
dockerdautostart when I boot up my machine. I actually like this, as it keeps my startup time fairly quick.
These could be remedied with shell scripts, but hey I'm running slackware :)
Happy Hacking & have a great day!