Monday, June 25, 2018

Installing Docker on Linux

In a previous post, I detailed how to run RavenDB on Docker. On this post, let's review in more detail how to install Docker on Linux so we can develop our applications using Docker containers.

But before we review how to install it, what is Docker anyway?


Docker provides a way to run applications securely isolated in a container, packaged with all its dependencies and libraries. Docker adds security, reliability, universal packaging and runs anywhere!

Why should I care about Docker?

Well, on that case it's better reading this. Long story short is that docker is way more efficient than full VMs, is very easy to install and has a huge repo of images that you can install on your machine. It's perfect for developers that have to install complex systems like RabbitMQ, Redis or PostGresSql on their machines. Let's take a look.

How Docker differs from VMs?

If you're interested on this topic, there's an interesting article that describes how Docker differs from VMS.

Installing Docker on Linux

Being Fedora, Ubuntu, Mint, Arch or whatever else Linux distro you're using, the way most users are installing Docker is by jumping into the terminal and running a command. It's that simple because the required packages are available on your distro's repository for free, courtesy of the awesome people that maintain those packages.

Because I've been running Fedora for 3 without distro-hopping and am very satisfied with my choice, let's use it for this demo. On my Fedora I simply type:

$ sudo dns install docker

After accepting, I see that everything has finished successfully and I'm ready to start the service:

Starting the Service

The docker bundle contains a client and a server. The client can be accessed by just typing docker:

So if I run docker ps with the server not started, I get the following error:

So, in order to start the service, I run:
$ sudo systemctl start docker

Testing the Install

In order to test the installation, I can then run as root:
$ docker run hello-world

Then, I can run docker ps again and see the command running successfully:

Installing on Windows and Mac

Installation on Windows and Mac should be straightforward too. Simply download the executable (Windows Users, Mac Users) and install on your machine.

Features Included

  • Integrated Docker platform and tools Docker command line, Docker Compose, and Docker Notary command line.
  • Automatic updates with channels for monthly Edge and quarterly Stable versions of Docker.
  • Fast and reliable performance with native macOS virtualization running a custom minimal Linux distro.
  • Seamless volume mounting for code and data, including file change notifications that unlock fast edit-test cycles.
  • Native Mac security support
  • In container development and debugging with supported IDEs.


We just showed how to install docker on Linux. For most distros it should be pretty similar. Windows and Mac users should follow the links provided and the installation format should be pretty standard.

In future posts, we will use Docker to create microservices, architectures and test complex systems using it. Keep tuned!

See Also

Docker for Developers
Downloading Docker
Download Docker for Windows Users
Download Docker for Mac Users
Docker Hub