How to Install Docker and Pull Images for Container Deployment in Digital Ocean

on May 31, 2020 · 3 mins read

This is a step-by-step tutorial that details on how to configure Docker and pull down images that can be deployed as containers.

Setup Digital Ocean

  1. Login to digitalocean.com and click on Create button on the top-right menu.
  2. Choose Droplet and click on Get Started with a droplet if you don’t have any droplets.
  3. For this tutorial choose, Ubuntu 18.04.2. Choose a plan per your needs. For this tutorial, we’ll be choosing $5/mo plan.
  4. Choose a data center then click on SSH keys for authentication.
  5. Click on Create Droplet now.
  6. SSH into your droplet by opening up a terminal/bash and typing in:

ssh root@your_ip_address and press enter.

You can look up your IPv4 address in the Digital Ocean control panel.

Enter the password provided to you on your email by Digital Ocean. Then, enter the new password for the root user. We’re inside our Ubuntu server now.

Install Docker

Let’s now install Docker which is available in the Ubuntu repositories.

Start by removing any previous Docker that could be installed on the system.

sudo apt-get remove docker docker-engine docker.io containerd runc

Now add the Docker’s official GPG key:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Verify that you have the key with the fingerprint by:

sudo apt-key fingerprint 0EBFCD88 which should produce the folowling output:


pub   rsa4096 2017-02-22 [SCEA]

      9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88

uid           [ unknown] Docker Release (CE deb) <docker@docker.com>

sub   rsa4096 2017-02-22 [S]

Add the stable docker repository:

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

Update the package index Sudo apt update

Install Docker CE

Sudo apt install docker-ce

Check that the docker is running successfully by running: docker run hello-world COnfigure the docker process to start and run on boot: systemctl start docker systemctl enable docker Pulling images WE now pull the images from the Docker hub which is a directory for images. We pull a image that is to be used for the docker containers. Let’s first check the system for previous images:

docker images

You’ll get a empty list which means no images have been pulled yet.

Let’s pull redis using pull command:

docker pull redis

Now check again by typing the command:

docker images

And you should see redis listed

If you don’t want to pull the official images you can also do:

docker search redis Which will give you alternatives.

You can pull the required image using the docker pull catleops/redis.