You’ve heard of Docker, and you know that it’s one of the best means of packaging your application into a standardized unit for deployment–you want that…but you’re not sure how to get it up and running.

To the uninitiated, Docker looks to be a complicated mess of an install. If you’re unsure where to start, the installation can be daunting. Truth be told, the installation is quite simple. I’ll help demystify that very process, so you can have Docker installed and ready to serve.

I’ll demonstrate this process on a fresh installation of Ubuntu 16.04. The entire installation process is handled via command line, so prepare to type.

SEE: Why the container community is wrong to whine about Docker

Update apt and add the key and repo

The first thing to do is update apt. To do this, open a terminal window and issue the command sudo apt-get update. Once that finishes, a new GPG key must be added for the repository used to install Docker. To add the new key, issue the following command:

sudo apt-key adv --keyserver hkp:// --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

The next step is to add the Docker repository. From the terminal window, create the new file with the command sudo nano /etc/apt/sources.list.d/docker.list and add the following contents:

deb ubuntu-xenial main

Save and close that file. Once again, update apt with the command sudo apt-get update.

Install the dependencies

Before we install Docker, there are a couple of dependencies that must be taken care of–these can all be handled with a single command. Go back to your terminal window and issue the following:

sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual

You’re ready to install Docker.

SEE: Netflix on containers: Five ways they’ll boost our business, from lower costs to higher productivity

Installing, starting, and testing Docker

Docker can now be installed with a single command. From the terminal, issue the following:

sudo apt-get install docker-engine

When the installation completes, you’ll want to add your user to the Docker group with the command:

sudo usermod -aG docker $USER

Once your user has been added, you can run the docker command as your standard user.

In order to run a Docker command, you must first fire up Docker with the command sudo service docker start. You can now test to make sure Docker is installed and running properly by downloading the hello-world test image. From the terminal window, issue the command docker run hello-world. The hello-world image will download and run (Figure A).

Figure A

The Docker hello-world image in action.

Docker is ready to serve

Congratulations! You now have a working Docker installation…ready to deploy your applications. You can head over to the Docker Hub and find other applications to run. Some of these applications will require you to create a docker-compose.yaml file. Say, for instance, you want to install WordPress with Docker. To do this, create the folder my-wordpress. Change into that directory and create the docker-compose.yaml file with the following contents (do not use tabs for indentation, as that will cause Docker to error out).

version: '2'
image: mysql:5.7
- "./.data/db:/var/lib/mysql"
restart: always
MYSQL_USER: wordpress

- db
image: wordpress:latest
- db
- "8000:80"
restart: always

Save that file and then, from within the my-wordpress directory, issue the command docker-compose up -d and WordPress will build. Once the build is complete, point your browser to http://IP_OF_SERVER:8000 (IP_OF_SERVER is the actual IP address of the machine running the Docker-installed instance of WordPress) and walk through the WordPress setup.

You’ve officially installed your first application from Docker.

Keep installing

You can go through the Docker Hub and check out the listed apps. Each installation will be different (some can be pulled directly from the Hub, without a .yaml file), but Docker makes installing these applications incredibly simple. And once you have your own software ready, you can deploy it through Docker as well.