Table of contents
Subscribe to our newsletter.
No spam
100% Great content
Special deals
Subscribe now

How to install Docker on your VPS/VDS?

Docker is a software platform for building and launching Linux containers. Linux Containers is a known technology that allows us to isolate kernel processes and make them think that they are the only ones running on the server. Containers are different from Virtual Machines because the containers share the same kernel while every VPS (VM) has its kernel (besides OpenVZ VPS, where in fact the "virtual machine" is a container).

 

Getting started with the installation of Docker

To install Docker you will need a Linux-based server, preferably running Debian/Ubuntu or CentOS. If your server is VPS/VDS, please have in mind that Docker can not operate if your VPS is based on OpenVZ 6. We would advise you to use KVM-based VPS or VDS (Dedicated Server).

 

Installing Docker

Installing Docker on VPS/VDS is a very easy process. Connect to your server via SSH with a privileged user (root).

 

The first step is to update (list of packages) your server.

For Debian/Ubuntu:

apt-get update

 

For CentOS:

yum update

 

Then simply run this command:

curl -sS https://get.docker.com/ | sh

 

This script will automatically detect your operating system, install the needed packages and install Docker. 

 

If there is no curl installed on your server, you can install it with the following command:

For Debian/Ubuntu:

apt-get install curl

 

For CentOS:

yum install curl

 

Then run the docker install command again. 

 

How to test our installation?

The Docker’s team recommends testing your Docker installation with a simple hello-world image.

 

To do this, simply run this command:

docker run hello-world

 

If everything is installed and working properly, you should see this output:

Unable to find image 'hello-world:latest' locally

latest: Pulling from library/hello-world

0e03bdcc26d7: Pull complete

Digest: sha256:31b9c7d48790f0d8c50ab433d9c3b7e17666d6993084c002c2ff1ca09b96391d

Status: Downloaded newer image for hello-world:latest



Hello from Docker!

This message shows that your installation appears to be working correctly.



To generate this message, Docker took the following steps:

 1. The Docker client contacted the Docker daemon.

 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.

    (amd64)

 3. The Docker daemon created a new container from that image which runs the

    executable that produces the output you are currently reading.

 4. The Docker daemon streamed that output to the Docker client, which sent it

    to your terminal.



To try something more ambitious, you can run an Ubuntu container with:

 $ docker run -it ubuntu bash



Share images, automate workflows, and more with a free Docker ID:

 https://hub.docker.com/



For more examples and ideas, visit:

 https://docs.docker.com/get-started/

 

Extra post-installation tips from us

Non-root access to Docker

Currently, we are logged into the server via root and we can manage the Docker application. It is a good idea to manage docker via a non-root user. But to do that, every time you want to use docker, you should use sudo. We can give non-root access to the docker management commands by typing these commands in the console:

groupadd docker
usermod -aG docker YOUR_USER

 

By doing this, your user will have access to the docker management and there is no need to use sudo every time you want to change something. 

 

Make docker run at startup of the OS

You can do that by running this command:

systemctl enable docker

 

Now, if your OS is being rebooted, Docker and all Docker containers will start automatically

 

 

If you need assistance installing Docker on your VPSBG server, please do not hesitate to contact us.

Choose your service now with instant activation.

Get started with no risk - we offer 30-day moneyback guarantee.

Get started