Click here to Skip to main content
15,920,603 members
Articles / Containers / Docker

Getting Started With Docker

Rate me:
Please Sign up or sign in to vote.
4.97/5 (13 votes)
13 Aug 2018CPOL5 min read 32.1K   23   26
Getting started with Docker by installing it and pulling a small image


In this article, we'll be walking through setting up Docker, pulling down a small Docker image, and running it.

Although this article was created as a way for CodeProject members to enter our Docker Challenge contest, it also serves well as a very basic tutorial if you've never used Docker before and are looking to get started.

What is Docker, and Why Should I Care?

Docker, and containerization in general, have exploded in popularity over the past few years. Popularity isn't always a good reason to use technology, though. The longer your software development career has been, the more likely it is that you've been drawn in by a new, shiny, popular bit of tech that ended up being a nightmare.

Docker, I believe, is one of those tools that actually lives up to the hype. A Docker container, as its name implies, is an isolated environment that your application(s) run inside. In practice, it works a bit like a virtual machine, but with a lot less overhead. A VM typically virtualizes an entire computer - CPU, RAM, input and output devices - plus an entire operating system running on top of it. Docker, in contrast, runs on top of an already installed OS and shares its kernel and RAM with the host OS. So there's no need to pre-allocate any CPU or RAM the way you would with a VM. The processes running inside a container simply use what they need, leaving the rest available for other containers or processes running on the host OS.

Typically, a Docker container holds a single application. The container also has all of the application's runtime dependencies, so there's no need to install anything or perform any setup steps - you simply pull a docker image to the machine where you want to run it, and then start the container.

Docker also uses immutable file systems - so if you have several applications that use a complex base image, like Ubuntu, you don't need to waste disk space by keeping a separate copy of the Ubuntu image for each application. Instead, you'll have a single copy of the Ubuntu base image, and each application's file system will contain only the differences between base image and the application image.

There's a lot more to Docker than we've covered here. If we tried to cover everything at once, this article would be long and boring! When trying out a new bit of technology, it's often best to try it out and see it in action, and then do a deep dive to learn everything. Since that's the approach we're going to take, we'll move on to installing and running Docker.

Installing Docker

Docker is available for Windows, Linux, and MacOS. We'll cover the installations steps for each OS.


Download Docker from for Windows Installer.exe.

Once the download im complete, run the installer. If given the option to choose between Windows and Linux containers, choose Linux.


Download Docker from

When the download is complete, open the .dmg file and run the installer. When the install is finished, you'll see a Docker application in the your Mac's applications folder. Run this application to start the Docker daemon.


Navigate to This address contains a bash file, and in a comment block near the top of the file, you'll see instructions on how to set up Docker on Linux. At present, setting up Docker requires running two terminal commands:

$ curl -fsSL -o
$ sh

Many Linux distributions offer a Docker package that can be installed via the distro's package manager. Some of these Docker packages are very old, however. As long as the version of Docker offered via your Linux distro is fairly recent - released in the past 12 months - it should be new enough to finish this tutorial.

Pulling a Docker Image

When Docker installs, it typically adds itself to your system path, and so can be run from anywhere when you open a command prompt or terminal. So to get started, let's open a terminal:

  • On Windows, open a Command Prompt or Powershell window.
  • On MacOS, open (or iTerm, if you prefer it).
  • On Linux, open xterm or whichever terminal program your Linux distro ships with.

Now, in your terminal window, run the following command:

docker pull codeproject/docker-contest

When you run the command, you'll see Docker pulling the CodeProject contest image from Docker Hub. The image should download quickly, as it is based on Alpine Linux, which is quite small - only a few megabytes.

Generating Your Contest Entry Code

Now that you've pulled the CodeProject contest image, it's time to generate the code you'll use to enter the contest! To do this, run the following command in your terminal:

docker run -it codeproject/docker-contest

The image will start, and you'll see it ask for your CodeProject member number. You can find your member number on your profile page, directly above your photo or avatar. Enter your number, and the CodeProject contest Docker image will give you a code you can use to enter the contest. You can find the contest entry page here.

And that's it! You've installed Docker, pulled down an image, and run it inside a Docker container. We've just scratched the surface of what's possible with Docker, but now that you've installed it and used it, you're in a good position to dive in to some more advanced tutorials.

Now What?

Looking to try some additional things with Docker?  

You might try these commands:

docker run hello-world
docker --version
docker info

Also, consider checking out the excellent overview and tutorial offered on the Docker site:


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Written By
Software Developer My House
Canada Canada
I spent 5 years working for Ottawa startups before returning home to Toronto. During Covid I decided to escape the big city and moved north to Penetanguishene, Ontario.

I'm a .NET/JavaScript/TypeScript developer and technical writer by day, but in the evening you'll often find me cooking up projects in Ruby, Haskell, Clojure, Elixir, and F#.

Comments and Discussions

BugDocker pull does not work on Docker for Windows Pin
VSarvothaman5-Oct-18 0:58
VSarvothaman5-Oct-18 0:58 
QuestionIMHO Pin
#realJSOP3-Oct-18 4:06
professional#realJSOP3-Oct-18 4:06 
QuestionUnauthorized to pull docker image Pin
number-phi12-Sep-18 5:08
professionalnumber-phi12-Sep-18 5:08 
QuestionYou may like to add a warning notice ... Pin
Richard MacCutchan22-Aug-18 5:03
mveRichard MacCutchan22-Aug-18 5:03 
QuestionDocker Via DigitalOcean Pin
raddevus17-Aug-18 5:03
mvaraddevus17-Aug-18 5:03 
AnswerRe: Docker Via DigitalOcean Pin
Ryan Peden17-Aug-18 11:07
professionalRyan Peden17-Aug-18 11:07 
QuestionUnfortunately the hyperlink to the page in which I need to enter the secret code generated is missing. Pin
Arthur V. Ratz16-Aug-18 19:17
professionalArthur V. Ratz16-Aug-18 19:17 
AnswerRe: Unfortunately the hyperlink to the page in which I need to enter the secret code generated is missing. Pin
Ryan Peden17-Aug-18 2:52
professionalRyan Peden17-Aug-18 2:52 
GeneralRe: Unfortunately the hyperlink to the page in which I need to enter the secret code generated is missing. Pin
Arthur V. Ratz17-Aug-18 2:55
professionalArthur V. Ratz17-Aug-18 2:55 
GeneralRe: Unfortunately the hyperlink to the page in which I need to enter the secret code generated is missing. Pin
Ryan Peden17-Aug-18 2:58
professionalRyan Peden17-Aug-18 2:58 
QuestionCodePoject member number Pin
EoRaptor14-Aug-18 18:20
professionalEoRaptor14-Aug-18 18:20 
AnswerRe: CodePoject member number Pin
Ryan Peden15-Aug-18 6:31
professionalRyan Peden15-Aug-18 6:31 
GeneralRe: CodePoject member number Pin
Arthur V. Ratz17-Aug-18 0:25
professionalArthur V. Ratz17-Aug-18 0:25 
GeneralRe: CodePoject member number Pin
Ryan Peden17-Aug-18 2:47
professionalRyan Peden17-Aug-18 2:47 
GeneralRe: CodePoject member number Pin
Arthur V. Ratz17-Aug-18 2:53
professionalArthur V. Ratz17-Aug-18 2:53 
GeneralRe: CodePoject member number Pin
raddevus17-Aug-18 4:57
mvaraddevus17-Aug-18 4:57 
I successfully ran the code and it told me I was registered also, but I wasn't added to the list either. It'll probably come up later, I guess?
GeneralRe: CodePoject member number Pin
Ryan Peden17-Aug-18 11:05
professionalRyan Peden17-Aug-18 11:05 
GeneralRe: CodePoject member number Pin
raddevus17-Aug-18 11:09
mvaraddevus17-Aug-18 11:09 
QuestionCannot find docker contest entry page, link seems to be missing Pin
Gunnar S13-Aug-18 9:23
Gunnar S13-Aug-18 9:23 
AnswerRe: Cannot find docker contest entry page, link seems to be missing Pin
Ryan Peden15-Aug-18 6:28
professionalRyan Peden15-Aug-18 6:28 
GeneralMessage Closed Pin
15-Aug-18 6:56
Gunnar S15-Aug-18 6:56 
GeneralRe: Cannot find docker contest entry page, link seems to be missing Pin
Ryan Peden15-Aug-18 7:16
professionalRyan Peden15-Aug-18 7:16 
GeneralRe: Cannot find docker contest entry page, link seems to be missing Pin
Ryan Peden17-Aug-18 2:53
professionalRyan Peden17-Aug-18 2:53 
GeneralMessage Closed Pin
17-Aug-18 3:49
Gunnar S17-Aug-18 3:49 
GeneralRe: Cannot find docker contest entry page, link seems to be missing Pin
Ryan Peden17-Aug-18 4:08
professionalRyan Peden17-Aug-18 4:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.