How to Install Docker on Ubuntu 23.04 on DigitalOcean

Docker is a popular platform for developing, shipping, and running applications in containers. It simplifies application deployment and management by providing a consistent and isolated environment for your applications. If you're using a DigitalOcean droplet running Ubuntu, you can easily install Docker to take advantage of its containerization capabilities. In this tutorial, we will walk you through the process of installing Docker on your Ubuntu-based DigitalOcean droplet.

Prerequisites

Before you begin, make sure you have the following prerequisites:

  1. A DigitalOcean account with a running Ubuntu droplet.
  2. SSH access to your droplet.

Step 1: Update Package Repository

Start by connecting to your DigitalOcean droplet via SSH. You can use your favorite SSH client or the DigitalOcean web console. Once connected, it's a good practice to update the package repository to ensure you have the latest package information.

Step 2: Install Required Dependencies

Docker requires some dependencies to be installed on your system. Run the following command to install them. Following sets apt to use HTTPS for package installations:

Add docker repository PGP key:

Add docker repository to apt:

Force apt to use docker repository instead of ubuntu:

Step 3: Install Docker

Now that you've added the Docker repository, you can install the Docker Engine:

Check if docker is running

The CLI should output something similar to folllowing:

● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; preset: enabled)
Active: active (running) since Wed 2023-11-08 06:55:37 UTC; 1h 1min ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 112025 (dockerd)
Tasks: 9
Memory: 34.8M
CPU: 920ms
CGroup: /system.slice/docker.service
└─112025 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Press q to exit

Congratulations! You've successfully installed Docker on your Ubuntu-based DigitalOcean droplet. You can now start using Docker to containerize and manage your applications. If you need further assistance or want to explore more Docker features, consider referring to Docker's official documentation.

References:

How To Install and Use Docker on Ubuntu 20.04, by Brian Hogan

Note: Some of the text is generated by ChatGPT.