Docker for Beginners Part 2 - Docker Installation on Mac and Ubuntu
Docker for Beginners Part 2 - Docker Installation
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
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:
$ 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
$ sudo apt-get install \
3 - Add Docker's official GPG key
$ 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:
$ 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) email@example.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:
$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
6 - Let's update the apt package index again:
$ 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.
$ 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!
Hacking Code FounderHacking 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.
Guides and Tutorials
Go Language Tutorial
Guides and Tutorials