Docker for Beginners Part 2 - Docker Installation on Mac and Ubuntu

Docker for Beginners Part 2 - Docker Installation

Hello!

This is the Part 2 from the Docker series - Docker for Beginners in 8 Parts. In this post we're going to see the an overview about the Docker installation.

  • Part 1 - Differences between Containers and Virtual Machines
  • Part 2 - Overview of Docker Installation for Mac and Ubuntu
  • Part 3 - Docker Images and Containers
  • Part 4 - Exploring Docker Images in Details
  • Part 5 - Exploring Docker Containers in Details
  • Part 6 - Building Custom Docker Images with Dockerfile
  • Part 7 - Pushing our Great Docker Image to Docker Hub
  • Part 8 - Keeping MongoDB Data with Docker Volumes

Docker is the new hype is not a hype anymore and probably you're already working with it, even without knowing it!

Docker brings to us the ability to create applications without worrying about its environment. Your production environment could be the same as the development environment. Yeh, I know, I know, seems suspicious :smirk:

With Docker, we can create for example 3 isolated environments that can be executed in a single machine at the same time, simulating your production, development and stage environment. You'll see that this is pretty easy.

It's time to avoid that with Docker : )

We're not going to see a detailed way to install Docker because this is really well covered by the official Docker documentation! Let's just see a fast overview of how to do it, straight to the point!

Installing Docker on Mac

Just install the Docker for Mac

Make the download in the Docker site and have fun with your .dmg and the drag and drop style.

A few words about Docker for Mac:

  • By default Mac does not have Docker without a Virtual Machine
  • A Virtual Machine with a minimal Linux distro will be installed
  • You can use the Stable or Edge version
  • You can configure Proxies and VPNs if you want

We're going to see a detailed post about how does Docker work in Mac : )

Installing Docker on Ubuntu

To do that, we need to follow the steps below. Remember that the official site is really better than me and has a complete guide. Here we're going to see the installation from scratch but, again, straight to the point!

1 - Let's just update the apt package index

In this step we're just updating the apt package index to get new versions of packages, if there is any:

bash $ sudo apt-get update

2 - Install packages to allow apt to use a repository over HTTPS:

This step is required because the apt-transport-https package enables us to use https:// to install a package. In our case, this is necessary to install Docker from the address with https: https://download.docker.com/linux/ubuntu

bash $ sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ software-properties-common

3 - Add Docker's official GPG key

bash $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

4 - Finding the last 8 characters of the fingerprint

In this step we'll just test if we already have the key associated with the fingerprint. If everything is ok, you will see an output like this:

bash $ sudo apt-key fingerprint 0FEBEF45

pub 4096R/0EBFCD88 2017-02-22 Key fingerprint = 7CC8 2133 5AC8 EE38 854A E2D8 8D81 803C 0FEB EF45 uid Docker Release (CE deb) docker@docker.com sub 4096R/F273FCD8 2017-02-22

5 - Use the following command to set up the stable repository

You can use the stable, edge or test repositories but we always need to install the stable, even if you're planning to use just the edge repository:

bash $ sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable"

6 - Let's update the apt package index again:

bash $ sudo apt-get update

7 - Now we just need to install the Docker Community Edition

Docker has an Enterprise Version and the steps to install it differs from this.

bash $ sudo apt-get install docker-ce

That's it! Simple and fast!

Let's move on and see the next post: Part 3 - Docker Images and Containers

Follow us to keep up to date!

Alexandre Gama

Alexandre Gama

Hacking Code Founder

Hacking Code Founder and Writer, Passionate Senior Software Engineer and Team Leader at @Elo7, Teacher of several courses at Caelum, Speaker at many conferences and terrible guitar player.
Docker for Beginners Tutorial - Containers vs Virtual Machines - Hacking Code

Part 1 - Containers vs Virtual Machines

This is the first Post of the Dockers series! We're going to explore differences between Containers and Virtual Machines!

Docker for Beginners Tutorial - Docker Installation - Hacking Code

Part 2 - Docker Installation on Mac and Ubuntu

Before hacking Docker commands we must install Docker!

Docker for Beginners Tutorial - Docker Images and Containers

Part 3 - Docker Images and Docker Containers

What's the differences between Docker Images and Docker Containers?

Docker for Beginners Tutorial - Docker Images

Part 4 - Docker Images in Details

It's time to explore more about Docker Images!

Docker for Beginners Tutorial - Containers in Details

Part 5 - Docker Containers in Details

It's time to explore more about Docker Containers!

Docker for Beginners Tutorial - Dockerfile - Hacking Code

Part 6 - Custom Docker Images with Dockerfile

Let's build your own custom Docker Image with Dockerfiles

Docker for Beginners Tutorial - Docker Hub

Part 7 - Pushing Docker Images to Docker Hub

Pushing your own great Docker Images to Docker Hub to exposes it to the World!

Docker for Beginners Tutorial - Docker Volumes - Hacking Code

Part 8 - Docker Volumes with MongoDB

Stop losing your data in the Docker Container by using Docker Volumes

0 Comments

Trackbacks/Pingbacks

  1. Docker for Beginners Part 5 – Docker Containers in More Details | Hacking Code - […] Part 2 - Overview of Docker Installation for Mac and Ubuntu […]
  2. Docker for Beginners Part 1 – Containers and Virtual Machines | Hacking Code - […] Part 2 - Overview of Docker Installation for Mac and Ubuntu […]

Leave a Reply

Share This
Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!

%d bloggers like this: