How to Install Docker and Pull Images for Container Deployment

Updated , by Linode Community

Traducciones al Español
Estamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.
Try this guide to receive $100 at signup on a new account.

How to Install Docker and Pull Images for Container Deployment

In this guide, you’ll install Docker and pull down images that can be deployed as containers.

Before You Begin

  1. Familiarize yourself with our Getting Started guide and complete the steps for setting your Linode’s hostname and timezone.

  2. Update your system (this example uses Ubuntu 16.04):

    apt update && apt upgrade
The steps in this guide require root privileges. Be sure to run the steps below as root or with the sudo prefix. For more information on privileges, see our Users and Groups guide.

Install Docker

These steps install Docker Community Edition (CE) using the official Ubuntu repositories. To install on another distribution, or to install on Mac or Windows, see the official installation page.

  1. Remove any older installations of Docker that may be on your system:

    sudo apt remove docker docker-engine
  2. Make sure you have the necessary packages to allow the use of Docker’s repository:

    sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg
  3. Add Docker’s GPG key:

    curl -fsSL | sudo apt-key add -
  4. Verify the fingerprint of the GPG key:

    sudo apt-key fingerprint 0EBFCD88

    You should see output similar to the following:

      pub   rsa4096 2017-02-22 [SCEA]
          9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
    uid           [ unknown] Docker Release (CE deb) <[email protected]>
    sub   rsa4096 2017-02-22 [S]
  5. Add the stable Docker repository:

    sudo add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable"

    For Ubuntu 19.04, if you get an E: Package 'docker-ce' has no installation candidate error, this is because the stable version of docker is not yet available. Therefore, you will need to use the edge / test repository.

    sudo add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable edge test"
  6. Update your package index and install Docker CE:

    sudo apt update
    sudo apt install docker-ce
  7. Add your limited Linux user account to the docker group:

    sudo usermod -aG docker $USER
    After entering the usermod command, you will need to close your SSH session and open a new one for this change to take effect.
  8. Check that the installation was successful by running the built-in “Hello World” program:

    docker run hello-world

Start and Enable Docker

Start and enable the Docker process to run on boot:

systemctl start docker
systemctl enable docker

Pull Docker Images

The first thing you are going to want to do is pull down an image to be used as the basis for your Docker containers. Docker Hub is the default registry from which to pull images.

  1. Use the images command to check what images already exist on your Linode. This example shows that no images are installed:

    docker images

    List Docker Images

  2. Pull the nginx web server, using the docker pull command:

     docker pull nginx

    This will pull the latest official nginx Docker image

    Pull Official nginx Image

  3. If you run docker images again, you’ll see the nginx image:

    docker images Shows the nginx Image

Find Unofficial nginx Images

Alternatively, if you don’t want to install the official nginx image, use docker search to find other nginx images:

docker search nginx

This command will list all variant images, along with a respective description, and whether or not they are official.

Run docker search nginx to Show Other nginx Options

Use docker pull to pull one of the other images:

docker pull blacklabelops/nginx

Ready to Keep Going?

At this point, you should know how to install Docker and pull down images with which you can then deploy containers. Use man docker to dive into the manual or visit our other Docker Guides to learn more.

This page was originally published on

Your Feedback Is Important

Let us know if this guide helped you find the answer you were looking for.