Share on Social Media

Learn how to install Docker on Ubuntu Server 18 with our comprehensive guide. Follow step-by-step instructions to set up Docker and start deploying containerized applications efficiently on your server. #centlinux #ubuntu #docker

What is Docker?

Docker is a set of Platform as a Service (PaaS) products that use operating system level virtualization to deliver software in packages called Containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels. All containers are run by a single operating-system kernel and are thus more lightweight than virtual machines. (Courtesy: Wikipedia)

The software that hosts the containers is called Docker Engine. It was initially developed in 2013 and now it is maintained by Docker, Inc.

Docker is a Freemium product and available in both Enterprise (commercial) and Community (free) editions.

Recommended Training for You: Docker for absolute beginners

5607844 2ee7show?id=oLRJ54lcVEg&offerid=1606991.5607844&bids=1606991

Docker Features

Some of the core features of Docker are.

  • Easy and Faster Configuration
  • Increase productivity
  • Application Isolation
  • Routing Mesh
  • Swarm – A cluster of Docker host machines
  • Security Management
  • Services

Docker Alternatives

If you’re looking for alternatives to Docker for containerization and orchestration, there are several other tools and platforms available that offer similar functionalities with different features and benefits. Here are some of the best Docker alternatives:

1. Podman

  • Description: A daemonless, open-source container engine developed by Red Hat.
  • Key Features:
  • No daemon; runs as a regular user.
  • Compatible with Docker CLI commands.
  • Strong security features and rootless containers.
  • Website: Podman

2. Kubernetes

  • Description: An open-source container orchestration platform for automating deployment, scaling, and management of containerized applications.
  • Key Features:
  • Automated container deployment and scaling.
  • Service discovery and load balancing.
  • Self-healing and automated rollouts and rollbacks.
  • Website: Kubernetes

3. OpenShift

  • Description: A Kubernetes-based container orchestration platform developed by Red Hat.
  • Key Features:
  • Enterprise-grade Kubernetes platform.
  • Integrated CI/CD pipelines.
  • Developer and operational tools for full application lifecycle management.
  • Website: OpenShift

4. LXC (Linux Containers)

  • Description: An operating system-level virtualization method for running multiple isolated Linux systems (containers) on a single control host.
  • Key Features:
  • Lightweight and minimal overhead.
  • Shares the host kernel.
  • Suitable for running multiple isolated Linux instances.
  • Website: LXC

5. CRI-O

  • Description: An open-source lightweight container runtime for Kubernetes.
  • Key Features:
  • Built for Kubernetes.
  • Supports Open Container Initiative (OCI) standards.
  • Lightweight and focused on container orchestration.
  • Website: CRI-O

6. rkt (Rocket)

  • Description: A container engine developed by CoreOS, now maintained by the community.
  • Key Features:
  • Security-focused design.
  • Supports multiple container image formats.
  • No central daemon; runs containers directly.
  • Website: rkt

7. containerd

  • Description: An industry-standard core container runtime that is a part of the CNCF (Cloud Native Computing Foundation).
  • Key Features:
  • High performance and simplicity.
  • Extensible with a clean and stable API.
  • Used by Kubernetes and other container platforms.
  • Website: containerd

8. Mesos

  • Description: An open-source project to manage computer clusters.
  • Key Features:
  • Scalable and fault-tolerant resource management.
  • Supports container orchestration.
  • Integrates with various frameworks like Marathon for container orchestration.
  • Website: Mesos

9. Nomad

  • Description: A flexible, enterprise-grade workload orchestrator developed by HashiCorp.
  • Key Features:
  • Supports containerized, non-containerized, and batch applications.
  • Multi-region and multi-cloud support.
  • Easy integration with other HashiCorp tools like Consul and Vault.
  • Website: Nomad

10. Singularity

  • Description: A container platform designed for scientific and high-performance computing (HPC) environments.
  • Key Features:
  • Designed for reproducibility and mobility of compute.
  • Supports unprivileged (rootless) containers.
  • Integrates well with HPC environments and workflows.
  • Website: Singularity

Comparing Docker Alternatives

ToolKey FeaturesSuitable For
PodmanDaemonless, rootless containers, Docker CLIDevelopment and production
KubernetesAutomated deployment, scaling, managementLarge-scale container orchestration
OpenShiftEnterprise Kubernetes, CI/CD integrationEnterprise environments
LXCLightweight, isolated Linux instancesRunning multiple Linux systems
CRI-OKubernetes integration, OCI standardsKubernetes environments
rktSecurity-focused, multiple image formatsSecurity-focused deployments
containerdHigh performance, Kubernetes integrationCore container runtime
MesosScalable resource management, container orchestrationCluster management
NomadMulti-region/cloud support, HashiCorp integrationMixed workloads and orchestration
SingularityHPC focus, rootless containersScientific and HPC environments

These alternatives offer various features that may better suit specific needs and use cases compared to Docker. Exploring these options can help you choose the best tool for your containerization and orchestration requirements.

Environment Specification

We are using a Ubuntu virtual machine with following specification.

  • CPU – 3.4 Ghz (2 cores)
  • Memory – 2 GB
  • Storage – 40 GB
  • Operating System – Ubuntu Server LTS 18.04
  • Hostname –
  • IP Address – /24
  • Admin User – ahmer

Update your Ubuntu Server

Connect with as ahmer user by using a ssh tool like PuTTY.

Update existing software packages by executing apt command.

$ sudo apt update

There are some package upgrades are available. Install these upgrades by using following command.

$ sudo apt upgrade

Install Docker on Ubuntu Server

Docker is available in apt repository, therefore, you can easily install it on Ubuntu server by using a single apt command.

$ sudo apt install

Enable and start Docker service.

$ sudo systemctl enable --now docker
Synchronizing state of docker.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable docker
Created symlink /etc/systemd/system/ â /lib/systemd/system/docker.service.

Verify version of installed Docker software.

$ docker --version
Docker version 18.09.7, build 2d0083d

Install Docker Compose on Ubuntu Server

Compose (or Docker Compose) is a software tool to define and run multi-container Docker applications. It uses YAML file to create, run and configure application services.

You can install docker-compose on your preferred Linux distro by using the following command.

$ sudo curl -L "$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   617  100   617    0     0    696      0 --:--:-- --:--:-- --:--:--   695
100 16.3M  100 16.3M    0     0   551k      0  0:00:30  0:00:30 --:--:--  636k

Grant execution permissions to all users on docker-compose executable.

$ sudo chmod +x /usr/local/bin/docker-compose

Create a soft link to docker-compose command in common binary path, so the command can be accessible from anywhere.

$ sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

Execute docker-compose command to check its version.

$ sudo docker-compose --version
docker-compose version 1.25.4, build 8d51620a

Docker Compose has been installed successfully on Ubuntu Server 18.04 LTS.

Execute Basic Docker Commands

Search for Alpine Linux in Docker online registry (Docker Hub).

$ sudo docker search alpine
NAME                                   DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED
alpine                                 A minimal Docker image based on Alpine Linux⦠  6038                [OK]
mhart/alpine-node                      Minimal Node.js built on Alpine Linux           453
roribio16/alpine-sqs                   Dockerized ElasticMQ server + web UI over Al⦠  7                                       [OK]
cfmanteiga/alpine-bash-curl-jq         Docker Alpine image with Bash, curl and jq p⦠  5                                       [OK]

Pull the image of Alpine Linux using docker command.

$ sudo docker pull alpine
Using default tag: latest
latest: Pulling from library/alpine
c9b1b535fdd9: Pull complete
Digest: sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
Status: Downloaded newer image for alpine:latest

List Docker images that are locally available on our Ubuntu 18.04 server.

$ sudo docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
alpine              latest              e7d92cdc71fe        6 days ago          5.59MB

Create a Docker container in interactive mode using Alpine Linux image and execute some test commands on it.

$ sudo docker run -it --rm alpine /bin/sh
/ # uname -a
Linux 40c0683c7989 5.0.0-38-generic #41-Ubuntu SMP Tue Dec 3 00:27:35 UTC 2019 x86_64 Linux
/ # cat /etc/os-release
NAME="Alpine Linux"
PRETTY_NAME="Alpine Linux v3.11"
/ # exit

Create a Docker container in detach mode from Alpine Linux image.

$ sudo docker run -d alpine

Check list of recently executed containers.

$ sudo docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS                          PORTS               NAMES
0ad0a833a2b3        alpine              "/bin/sh"           About a minute ago   Exited (0) About a minute ago                       mystifying_blackburn

Remove a container as follows.

$ sudo docker container rm 0ad0a833a2b3

Remove an image that is locally available on our Ubuntu 18.04 server.

$ sudo docker rmi alpine
Untagged: alpine:latest
Untagged: alpine@sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d
Deleted: sha256:e7d92cdc71feacf90708cb59182d0df1b911f8ae022d29e8e95d75ca6a99776a
Deleted: sha256:5216338b40a7b96416b8b9858974bbe4acc3096ee60acbc4dfb1ee02aecceb10

You have successfully installed Docker on Ubuntu 18.04 server and executed some basic commands thereon.  You should also read our guide on how to install Docker on CentOS 8.

If you wish to learn more about containers then you should read Docker in Action (PAID LINK) by Manning Publications.

Final Thoughts

Installing Docker on Ubuntu Server 18 is a great way to streamline your application deployment and management. With Docker, you can easily create, deploy, and run applications in containers, ensuring consistency across multiple environments.

For a detailed, step-by-step guide on how to install Docker on Ubuntu Server 18, check out my Fiverr gig: Install & Configure Docker on Ubuntu Server. I provide expert assistance to help you set up Docker efficiently and effectively.

If you have any questions or need further support, feel free to reach out!

Leave a Reply