Virtualization enables an administrator to run multiple operating systems images on one piece of hardware, all at the same time. This is especially important in instances where you need to abstract a guest operating system, network, data storage, or application away from the underlying software or hardware. Docker has quickly become an alternative to virtual machines.
Traditionally, virtualization involves the creation of virtual machines isolated at the level of the hardware. While this may be effective when you want to install a full guest operating system, sometimes all you need is to isolate an application (application virtualization) at the operating system level. This is known as application containerisation, which can be achieved through the use of software containers.
What is Docker?
Docker is a popular containerization app that is used to create software containers. Released in 2013, Docker made it unnecessary to use virtualization machines to run apps separate from the OS. You can simply run multiple apps in isolated software containers, without the need for VirtualBox or VMware Fusion/Workstation.
Docker containers will wrap a piece of software in a file system containing everything required to run, such as code, system libraries, runtime and system tools. The software will run the same way no matter the type of environment it is in. The application is packaged together will all its dependencies into one unit for efficient software development.
Docker makes it unnecessary to install multiple virtual machines, each running the same operating system with just a single app installed. You have one single engine installed with several containers on top for running several apps.
Using containers provides greater functionality and efficiency for app virtualization. Since containers do not have a whole OS, they are smaller, easy to create, customize, and boot within seconds. The containers also share resources with the host OS, creating less demand on the CPU, RAM, and other computing resources.
Developers can, therefore, focus on building software, rather than setting up and maintaining software development environments through the construction of virtualization machines.
Furthermore, Docker Hub makes it easier to create, distribute, store or manage images in collaboration with a team. Any updates or changes are easily and quickly shared with the rest of your team or across the whole organization. You can also easily share your app with others, have them link to it and test it without the need to learn how it works.
How to install Docker on Mac
The initial versions were only compatible with Unix operating systems. However, it’s now available for Windows, Windows Server 2016, as well as Mac. Docker for Mac or Windows can run using native virtualization on new Macs with OS X El Capitan or Windows PCs with Hyper-V.
It can also work (with limited support) on 10.10.3 Yosemite running on a 2010 or later Mac, as long they have hardware support for Intel MMU virtualization and at least 4GB RAM.
If you are using a Mac lacking the requirements for Docker, you will need to run Linux somehow on your Mac. This can be done using a Virtual Machine such as Oracle VM VirtualBox, which is a free and open source virtualization tool. Oracle VM VirtualBox is included in the Docker Toolbox; an all-in-one installer for setting up and launching an environment on your Mac.
The Toolbox also comes packaged with:
- Docker Machine: This is for running docker-machine commands.
- Docker Engine: This is used to run the docker commands.
- A preconfigured shell for a Docker command-line environment.
- Kitematic: This is the GUI for Docker
Please note that the toolbox will require a working Terminal application, as well as OS X version 10.8 Mountain Lion or higher.
To check your system requirements, just click on the Apple icon on the top left of the navigation menu. From the drop-down menu, click the About this Mac option to display your system specifications.
How to get started
Follow these steps to get Docker up and running on your Mac:
1. Install Docker Toolbox
A. Start by downloading the Docker toolbox from the Docker Toolbox page by selecting the Install Docker Toolbox on MacOS
B. Double click on the installer file, and once you get the welcome page, click Continue.
C. Follow the prompts until you get to the Installation Type page, where you have the option to customize your installation. It is preferable to stick to the default options.
D. Make sure that every component on the Installation Type box is checked, then click Install The binaries shall be installed to /usr/local/bin by default.
E. Once the installation is done, click Continue. You may ignore the shortcuts provided in the Quick start step. You can then click Close once the Installer confirms that the installation was successful.
2. Set Up Docker
You will then create a new Docker virtual machine and then switch to the VM environment. In this environment, you can use the docker client run and manage your Docker containers.
Proceed using the following steps:
A. Open Launchpad, and then click the Quickstart Terminal icon. This will open a terminal window, which will set up Docker for you. The output in the terminal window will have this confirmation: The Quick Start terminal is configured to use Docker
B. Type the command docker run hello-world in the terminal. The resulting output will show: Hello from Docker; this message shows that your installation appears to be working correctly.
This will confirm that Docker is up and running on your Mac.
However, if the hello-world image is not on your local system, the Docker client will take a moment to get the image from Docker Hub.
In that case, when you enter docker run hello-world command, an output will appear which reads Downloaded newer image for hello-world: latest
Thanks for reading, let me know in the comments below your experience and if you have any tips for the community.