You decide which services we may enable for analytics, personalization, and external content.
We use cookies and similar technologies on our website to personalize content, embed external media, and better understand how individual areas are used.
Necessary cookies
These entries support essential functions such as security, stability, and form processing.
Optional sections
AnalyticsMarketingPersonalizationExternal media
Your data may be processed with your consent or on the basis of legitimate interests. In the cookie settings, you can reject or explicitly allow each optional category.
Some services process personal data in third countries. By consenting, you also agree to this transfer. You can find more information in our Privacy Policy.
You can reopen and change your selection at any time. · 1.0.2
Setting Up Docker on a Linux Server – Launch and Manage Containers on Your Infrastructure
Discover how to install Docker on your Linux server to efficiently run isolated applications and optimize resource usage → Learn more now
10 November 20264 min read2 Views0 helpful
Introduction
Docker is a lightweight, open-source virtualization software that allows you to deploy services or applications isolated on a single system. Unlike traditional virtual machines, it does not emulate or host an additional operating system but only an application environment within the host system. This not only saves resources in general but also ensures low overhead compared to full virtualization. In this guide, we show you how to install Docker on your server.
FAQ
Frequently asked questions
Connect to your server via SSH, add Docker’s official GPG key to your repository list, then set up the Docker repository in your apt sources to install and update Docker from there.
Docker does not emulate or host a separate operating system like a virtual machine but provides only an application environment within the host system, saving resources and reducing overhead compared to full virtualization.
Feedback
Was this article helpful?
Your feedback helps us prioritize and improve content.
0 of 0 Users found this article helpful.
Personal support
Need more help than the guide provides?
Our ZAP support team knows your product — briefly describe your issue and we'll help you personally.
Navigation
Software
Preparation
First, you need to connect to your Linux server via SSH. If you need help with this, check out our First Access (SSH) guide. In this tutorial, we use Ubuntu as the Linux distribution.
Installation
Once connected to your Linux server, you can start with the installation methods. Choose the appropriate Linux repository below to see the relevant installation steps.
Ubuntu
First, you need to add and configure the Docker package via apt. This allows you to easily install and update Docker from the repository later.
Run the following commands to add Docker’s official GPG key to your repository list.
Now that you have added the Docker repository, run apt-get update to apply the changes.
Code
sudo apt-get update
Up to this point, you have successfully set up the Docker apt repository. As the final step, install the Docker packages. Install the latest version with this command:
Now that you have added the Docker repository, run apt-get update to apply the changes.
Code
sudo apt-get update
Up to this point, you have successfully set up the Docker apt repository. As the final step, install the Docker packages. Install the latest version with this command:
Docker should now be installed. As the final step, start and enable the service to make it work.
Code
sudo systemctl enable --now docker
To check if the installation was successful, try running the hello-world image with this command:
Code
sudo docker run hello-world
If everything works, you should see a friendly welcome message with some basic info in the terminal. If you get Permission Denied errors, make sure you have enabled Docker compatibility in your web interface and restarted the server as described in the preparation section.
You have successfully installed Docker on your Linux server.
After Installation
Now that Docker is running on your server, you can make a few settings to, for example, avoid using sudo with Docker commands and to start Docker automatically when the server boots.
Use Docker Without Sudo
You can save yourself from always prefixing Docker commands with sudo by creating a new Docker group and adding your user to it. This makes usage more convenient but be aware that you are indirectly granting root privileges.
Create the docker group and add your current user with these commands:
Code
# Create Docker group
sudo groupadd docker
# Add current user to Docker group
sudo usermod -aG docker $USER
We recommend restarting the server afterward so the group membership is reloaded. Alternatively, you can run newgrp docker.
Now test if you can run Docker commands without sudo by running docker run hello-world again.
Tip
Sometimes you get an error due to a configuration file if you ran the command previously with sudo. To fix this, simply delete the Docker directory with rmdir ~/.docker/. It will be recreated automatically on the next command.
If the command runs without errors, you have successfully set up Docker to run without sudo.
Start Docker on System Boot
You can configure Docker to start automatically when the server boots by using systemd – which is used by most Linux distributions.
Tip
On Ubuntu & Debian, Docker is set by default to start automatically on boot. If you use one of these distributions, you don’t need to do anything further.
To enable the Docker service at boot, simply run these commands:
Congratulations, you have successfully installed and configured Docker on your Linux server! If you have any questions or problems, our support team is available daily and happy to help!
Server hosting from €2.49 / month, online instantly, DDoS protection included.