author | contributor | description | keywords | license | published | modified | modified_by | title | external_resources | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
An introduction to using Docker, containers, and dockerfiles on your Linode. |
docker,container,dockerfile,install docker |
[CC BY-ND 4.0](https://creativecommons.org/licenses/by-nd/4.0) |
Monday, July 17, 2017 |
Monday, October 23, 2017 |
|
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.
-
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
{: .note}
The steps in this guide require root privileges. Be sure to run the steps below as
root
or with thesudo
prefix. For more information on privileges, see our Users and Groups guide.
-
As of this writing, the recommended Docker installation is Docker CE. Remove any older installations of Docker that may be on your system:
apt remove docker docker-engine docker.io
-
Make sure you have the necessary packages to allow the use of Docker's repository:
apt install apt-transport-https ca-certificates curl software-properties-common
-
Add Docker's GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
-
Verify the fingerprint of the GPG key:
apt-key fingerprint 0EBFCD88
You should see output similar to the following:
{:.output}
pub 4096R/0EBFCD88 2017-02-22 Key fingerprint = 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88 uid Docker Release (CE deb) <[email protected]> sub 4096R/F273FCD8 2017-02-22
-
Add the
stable
Docker repository:add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
-
Update your package indesx and install Docker CE:
apt update apt install docker-ce
-
Add your limited user account to the
docker
group:usermod -aG docker exampleuser
You will need to restart your shell session for this change to take effect.
-
Check that the installation was successful by running the built-in "Hello World" program:
docker run hello-world
Start and enable the Docker process to run on boot:
systemctl start docker
systemctl enable docker
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.
-
Use the
images
command to check what images already exist on your Linode. This example shows that no images are installed:docker images
-
Pull the nginx web server, using the
docker pull
command:docker pull nginx
This will pull the latest official nginx Docker image
-
If you run
docker images
again, you'll see the nginx image:
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.
Use docker pull
to pull one of the other images:
docker pull blacklabelops/nginx
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.