How to setup Docker on Solus
While you won’t get a package file from Docker directly, the Solus Project’s eopkg
command makes setting up Docker easy enough.
Install Docker
First install Docker with eopkg
:
sudo eopkg install -y docker
To start the Docker daemon execute:
sudo systemctl start docker.service
If you want to have Docker daemon start automatically on boot, run:
sudo systemctl enable docker.service
Execute Docker commands without sudo
Docker’s Linux Post Install documentation includes some great steps you may want to follow. The one that is the most meaningful to me is to execute Docker commands without sudo by adding yourself to the docker
group.
First, ensure the docker
group exists, if it does you’ll receive an error that groupadd: group 'docker' already exists
which you can ignore.
sudo groupadd docker
Next, add your user to the Docker group.
sudo usermod -aG docker $USER
Finally, completely log out and log back in.
Ensure tini
is installed
Tini is a small application that ensures signal forwarding occurs within Docker containers. If you’ve ever attempted to perform a SIGINT (ctrl-c
) in a Docker container and had it not interrupt the process, this is the type of issue Tini solves.
Since Docker 1.13, Tini is included whenever you run a container with the --init
flag. However, when I ran through this guide I’d encounter an error. To see if you have the same problem, run:
docker run --rm -it --init alpine echo "success"
If you see “success” then you can skip the rest of this section.
However, if you see something like:
docker: Error response from daemon: exec: “docker-init”: executable file not found in $PATH.
Then the Docker package installed with eopkg
doesn’t include Tini and you’ll need to install it yourself so that Docker can use it.
I was able to do this by downloading the tini-static binary from Tini’s GitHub releases, making it executable, and saving it as /usr/bin/docker-init
.
Terminal commands I used (be sure to change the version if you so desire):
curl -L -o docker-init https://github.com/krallin/tini/releases/download/v0.18.0/tini-static \
&& chmod +x docker-init \
&& sudo mv docker-init /usr/bin/docker-init
Now when running docker run --rm -it --init alpine echo "success"
you should see “success”.