How to install Docker on synology / linux / vps
Docker simplifies deployment and scaling by allowing applications to be easily moved between different environments, including local machines, staging servers, and production systems.
Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers.[1]
A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another.
A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings.
Container images become containers at runtime and in the case of Docker containers – images become containers when they run on Docker Engine. Available for both Linux and Windows-based applications, containerized software will always run the same, regardless of the infrastructure. Containers isolate software from its environment and ensure that it works uniformly despite differences for instance between development and staging.[2]
Version used
There can be slight differences on installation processes if you are on different versions or hardware
Application | Version |
---|---|
Ubuntu | 20.04 |
Synology DSM | 7.2.1-69057 Update 4 |
Docker Compose | 1.29.2 |
How to install Docker
On Linux device
I assume that you know the most basic of unix commands and server setup
Prepare the device
-
SSH to your device
-
Make sure that you have updated
apt
package indexsudo apt-get update && sudo apt-get upgrade -y
-
Allow
apt
to use repo over httpssudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
-
Add docker official
GPG
keycurl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
-
Setup the repo
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
Install Docker CE
-
Install
Docker CE
andcontainerd
runtimesudo apt-get install docker-ce docker-ce-cli containerd.io
Install Docker Compose
-
Install
Python
andpip
package manager to installDocker Compose
sudo apt install -y python3 python3-pip
-
Install
Docker Compose
sudo pip3 install docker-compose
Create Docker user
-
Create a new user i.e.
dockeruser
adduser dockeruser
-
Add that user to docker group
usermod -aG docker dockeruser
-
Restart docker service
systemctl restart docker
Test Docker
-
Test if docker is running fine
sudo docker run --name hello-world-container hello-world
-
You should get this:
Hello from Docker! This message shows that your installation appears to be working correctly.
-
Remove the container if it is running fine
sudo docker rm hello-world-container
Configure autostart
-
Enable docker to run on system boot
systemctl enable docker
On Synology NAS
- Log in to
DSM
and open thePackage Center
- Type
container
in the search bar, hitENTER
- Click
Install
on theContainer Manager
- Wait a couple of minutes and
Continer Manager
will show in theInstalled
tab inPackage Center
. It should also show in theMain Menu
.