How to Install Docker and Pull Images for Container Deployment
Updated by Linode Contributed by Jack Wallen
In this guide, you’ll install Docker and pull down images that can be deployed as containers.
Before You Begin
Familiarize yourself with our Getting Started guide and complete the steps for setting your Linode’s hostname and timezone.
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
rootor with the
sudoprefix. For more information on privileges, see our Users and Groups guide.
apt install docker.io
You will be presented with all necessary dependencies and asked to accept the installation. Type
y to accept and complete the installation.
If you are using CentOS 7, use
sudo yum check-update && curl-fsSL https://get.docker.com/ | sh
Docker installation adds the group
docker to your Linode. Create the user
exampleuser, give it
sudo privileges, and add it to the Docker group:
adduser exampleuser usermod -aG docker exampleuser
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.
imagescommand to check what images already exist on your Linode. This example shows that no images are installed:
Pull the nginx web server, using the
docker pull nginx
This will pull the latest official nginx Docker image
If you run
docker imagesagain, you’ll see 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.
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.
You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.
This guide is published under a CC BY-ND 4.0 license.