Photo by Joe Holland / Unsplash

How to install Docker on synology / linux / vps

docker Aug 5, 2024

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]


  1. https://en.wikipedia.org/wiki/Docker_(software) ↩︎

  2. https://www.docker.com/resources/what-container/ ↩︎

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

  1. SSH to your device

  2. Make sure that you have updated apt package index

    sudo apt-get update && sudo apt-get upgrade -y
    
  3. Allow apt to use repo over https

    sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
    
  4. Add docker official GPG key

    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    
  5. Setup the repo

    sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
    

Install Docker CE

  1. Install Docker CE and containerd runtime

    sudo apt-get install docker-ce docker-ce-cli containerd.io
    

Install Docker Compose

  1. Install Python and pip package manager to install Docker Compose

    sudo apt install -y python3 python3-pip
    
  2. Install Docker Compose

    sudo pip3 install docker-compose
    

Create Docker user

  1. Create a new user i.e. dockeruser

    adduser dockeruser
    
  2. Add that user to docker group

    usermod -aG docker dockeruser
    
  3. Restart docker service

    systemctl restart docker
    

Test Docker

  1. Test if docker is running fine

    sudo docker run --name hello-world-container hello-world
    
  2. You should get this:

    Hello from Docker!
    
    
    This message shows that your installation appears to be working correctly.
    
  3. Remove the container if it is running fine

    sudo docker rm hello-world-container
    

Configure autostart

  1. Enable docker to run on system boot

    systemctl enable docker
    

On Synology NAS

  1. Log in to DSM and open the Package Center
  2. Type container in the search bar, hit ENTER
  3. Click Install on the Container Manager
  4. Wait a couple of minutes and Continer Manager will show in the Installed tab in Package Center. It should also show in the Main Menu.
Docker: Accelerated Container Application Development
Docker is a platform designed to help developers build, share, and run container applications. We handle the tedious setup, so you can focus on the code.

Tags