Matthew Ames

Docker on Solus

Matthew Ames - 2016-05-18 - 9:08 am

Installing

Running docker on Solus is relatively straight forward if you follow the instructions here: https://docs.docker.com/engine/installation/binaries/

If you don’t want to go to that link, here’s it all is in a shorter form (though it may not work fully for your system):

wget https://get.docker.com/builds/Linux/x86_64/docker-latest.tgz
tar -xvzf docker-latest.tgz
sudo mv docker/* /usr/bin/
sudo docker daemon &

Extremely simple, is it not?

Docker service

Although the above is good, we’ll probably want to be able to run as a background service. This is done with some systemd units, which you should create with the following contents:

/etc/systemd/system/docker.service

[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network.target docker.socket
Requires=docker.socket

[Service]
Type=notify
EnvironmentFile=-/etc/default/docker
ExecStart=/usr/bin/docker daemon -H fd:// $DOCKER_OPTS
MountFlags=slave
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
TasksMax=infinity
TimeoutStartSec=0
Delegate=yes

[Install]
WantedBy=multi-user.target

/etc/systemd/system/docker.socket

[Unit]
Description=Docker Socket for the API
PartOf=docker.service

[Socket]
ListenStream=/var/run/docker.sock
SocketMode=0660
SocketUser=root
SocketGroup=docker

[Install]
WantedBy=sockets.target

Now all that’s required is to enable and start the service:

sudo systemctl enable docker && sudo systemctl start docker

Docker without Sudo

This is a very common requirement, and is easy to fulfill. Simply run the following command, being sure you replace <username> with your username.

sudo groupadd docker && sudo usermod -aG docker <username>

 

0 Comments