Image showing the Docker logo accompanied by the text "How to install Docker on a VPS"

How to install Docker on a VPS

Docker is a tool that enables developers to build, run, verify and share projects within cohesive packages called Docker containers.

In addition to the code; many applications and websites require additional elements like databases, configuration files, runtime libraries or third-party software to function properly.

With Docker; instead of having to install and setup the application itself and then each dependency for every deployment; an end user can simply pull and run a Docker container and be ready to go.

Docker runs on x86, x64 and ARM CPU architectures on macOS, Linux and Windows. Running apps from Docker containers means you don’t need to spend time and resources creating, optimising and maintaining versions for all possible hardware and software combinations.

Applications will run the same way on any device regardless of any architectural, OS or settings differences between the client machine and the original computer used to write and test the code.

Why use Docker?

Docker is perfect for dev teams as it allows projects to be deployed across different environments and operating systems regardless of where it is built. If a project runs locally: it will run remotely too!

If you regularly build applications with the same dependencies, you can create templates to avoid having to repeat the same steps over and over again.

Docker is very useful for web applications running on server-based software if you have decent command line chops. GUIs, like Portainer, can be installed on top of Docker with minimal performance impact for users who prefer a more visual workflow.

When you should use Docker

  • Your projects need to run in different environments
  • Your projects consist of many parts or dependencies
  • Your hosting changes or may change in the future

When you shouldn’t use Docker

  • Your project is very small and simple
  • Your project is a standard desktop application

Getting Docker on your VPS

Docker runs natively on Linux (x86-64, ARM and many other CPU architectures) and Windows (x86-64) which means it can be installed on all of the operating systems we offer with our Virtual Private Servers (VPS).

The installation process can differ slightly depending on the underlying operating system of your VPS, so we have included our most popular OS choices:

Alma Linux logo

Alma Linux 9.4

Open a terminal with sudo privileges and run this command to update all existing system packages:

sudo dnf update –y

Add the Docker repository:

sudo dnf config-manager –add-repo=https://download.docker.com/linux/centos/docker-ce.repo

Install the Docker Engine:

sudo dnf install docker-ce docker-ce-cli containerd.io

Start and Enable Docker:

sudo systemctl start docker
sudo systemctl enable docker

To verify the installation was successful, you can run the ‘hello-world’ image:

class=”language-sh”>sudo docker run hello-world

Ubuntu logo

Ubuntu 22.04

Open a terminal with root privileges and run these commands to update existing packages and set up the Docker repository:

sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

Install the latest version of Docker:

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

To verify the installation was successful, you can run the ‘hello-world’ image:

sudo docker run hello-world

Graphic depicting Docker going head-to-head with a Virtual Machine

Containers Vs. Virtual Machines

I can almost hear you saying: “Docker containers sound an awful lot like virtual machines. Why would I bother using Docker when I could just use VMs?”. There are a number of key differences:

Virtual machines

  • VMs emulate physical hardware, allowing you to run multiple operating systems on a single physical machine.
  • Each VM includes a full operating system, along with the application, binaries, and libraries, leading to larger overhead.
  • VMs require a hypervisor to manage them, which introduces some performance overhead.
  • They offer strong isolation between applications since each VM has its own kernel and memory space.

Docker containers

  • Containers virtualise the operating system instead of emulating hardware, allowing multiple applications to run on the same OS kernel.
  • Hardware of the host machine can be passed through to containers to enable features like GPU acceleration – but the hardware must physically exist to do so.
  • Containers package an application and all its dependencies into a single image, which is lightweight and portable.
  • Containers share the host OS kernel, which leads to lower overhead and faster startup times compared to VMs.
  • They are highly efficient, allowing for greater density of applications on a single host.
  • Containers provide less isolation compared to VMs since they share the same kernel.
  • Docker provides version control for its containers that allow users to track versions, roll back versions and manage differences between versions.

Getting the most out of your VPS with Docker

Having your own server securely nestled in a world class datacentre with unlimited bandwidth means that there are many useful services that you can run for personal and business purposes – often at no extra cost.

If you’d like to host your own secure password manager, note taking application, smart home hub, adblocker and much more – you can do so very easily with Docker!

Hosting these services on your own VPS is great for privacy enthusiasts as only you will have access to your data.

Repositories such as dockerhub and linuxserver.io host vast arrays of first party and community-maintained Docker images that are free to download, install and use – and are an excellent place to see what is possible.

So – will you be using Docker? What additional services will you run on your VPS? Are you interested in a follow-up article covering Docker Swarm? Let us know in the comments!

Deploy all your apps with great value virtual server hosting, no compromises. Our high-performance VPS include:

  • Lightning-fast speed with 100% SSD storage
  • Genuine unlimited bandwidth – no throttling, ever
  • Deploy standard distro, 1-click app or custom image
  • Manage your servers through one single, intuitive control panel
  • 100% green hosting powered by renewable energy

Find out how our VPS Hosting is the perfect choice, from personal projects to complex apps.

Add comment