Most of the time, Docker is installed on Linux operating systems, but you can also use Docker for Windows or Docker for Mac if you have a Windows or a Mac and want to containerize your applications using Docker. To install Docker for Windows or Docker for Mac, your system needs to meet below minimum requirements:
- For Mac, Mac version needs to be OS x 10.10.3 or newer.
- For Windows, Windows version needs to be Windows 10 Pro or higher (Docker for Windows in not supported on Widows 10 Home edition).
- Your system platform needs to be 64-bit.
However, If your system does not meet one of the requirements listed above, you can install Docker Toolbox, which is a legacy desktop software to run Docker containers for old systems where Docker for Windows or Docker for Mac is not supported.
What is Docker Toolbox and Why Do I Need it?
Docker Toolbox is a software bundle that includes the following tools:
- Docker CLI client for running Docker Engine to create images and containers.
- Docker Machine to provision and manage multiple remote Docker hosts, or provision Swarm clusters from your Windows or Mac management machine box.
- Docker Compose for running the docker-compose command and defining multi-container applications.
- Kitematic, which a Docker Web GUI tool to manage containers.
- The Docker QuickStart, which is a shell preconfigured for a Docker command-line environment.
- Oracle VM VirtualBox to run the Docker Engine Linux VM.
In case you already have Docker Engine already installed on a Windows or a Mac host, and want to install Docker Compose, Docker Machine, or Kitematic, Docker Toolbox will also be your option.
Because Windows 7, Windows 8 or Windows 10 (32-bit or 64-bit non Pro) do not have Hyper-V, while installing Docker Toolbox on these OSs, Oracle VM Virtualbox will also be installed and a small Linux VM called docker-machine is created and started on top of it. The main function of this VM is to run Linux-specific kernel features needed by Docker Engine as these ones cannot be provided natively by your Windows or Mac system.
This will not be the case for Windows 10 Pro and higher as Hyper-V can be leveraged by Docker for Linux-specific kernel features.
If Oracle VM Virtualbox is already running on your machine, make sure to shut it down to avoid any conflict before running the Docker Toolbox installer.
Installing Docker Toolbox on Windows 7, Windows 8 and Windows 10
Checking the Prerequisites
Docker can only be installed on a machine that has a 64-bit operating system running Windows 7 or higher, with hardware virtualization enabled.
To check if your OS is 64-bit, simply go to Control Panel > System and Security > System and see if the System Type value is 64-bit Operating System.
To check if virtualization is enabled on Windows 7, you can download and run Microsoft® Hardware-Assisted Virtualization Detection Tool.
If this tool detects that your Windows 7 box has virtualization enabled, you will get a prompt like this.
Downloading Docker Toolbox
Depending on the platform used, Docker Toolbox comes in two flavors, one for Mac and another one for Windows.
You can get Docker Toolbox for Windows from here.
Installing Docker Toolbox on Windows 7, 8 and 10
Once downloaded, run the the DockerToolbox binaries as Administrator.
On the Welcome to the Docker Toolbox Setup Wizard, click Next.
Select the components you want to be installed. The full installation will install Docker Client for Windows, Docker Machine for Windows (a tool that lets you install and manage Docker Engine on remote hosts), Docker Compose for Windows (a tool for defining and running multi-container Docker applications), VirtualBox to host the Docker Machine, Kitematic (a GUI web tool to deploy and manage containers easily), and Git for Windows.
Review the installation options summary on the Ready to install window, then click Install if you’re sure about your choices.
This will go through the installation process and will take some time. Grab a cup of fee and give it sometime to finish.
If you chose to open shortcuts in Explorer at the end of the Docker Toolbox installer, you will see both Docker CLI (Docker Quickstart Terminal) and GUI Kitematic (Alpha) shortcuts as in the picture below.Click on the Docker QuickStart Terminal icon to launch a pre-configured Docker Toolbox terminal. This will go through some configuration steps to start and configure the docker-machine VM. You might need to provide admin privilege by clicking Yes If the system displays a User Account Control prompt to allow VirtualBox to make changes to your computer.
You can see the IP address assigned to the Docker Machine, which is 192.168.99.100. This IP is pingeable from my local machine and will be used to interact with containers that you deploy using Docker Toolbox.
What Happened in the Background?
On successful installation, the following will happen:
- A folder X:\Program Files\Docker Toolbox (where X: is the drive letter you have chosen during the installation) is created that contain several executables.
- Along with these executables, the ./start.sh file is a script that will actually launch and configure the boot2docker Docker Machine VM. The Docker Quickstart Terminal is nothing but a shortcut to this script.
- The X:\Program Files\Docker Toolbox folder was added to your Environment PATH variable. As such, you’ll be able to run the docker-machine.exe and docker.exe client programs from your cmd line terminal without specifying the full path, which is quite handy.
- When you click on Docker Quickstart Terminal to start the Docker CLI client, Docker Toolbox starts the boot2docker Docker Machine VM in the background and did all the necessary configuration. If you launch Oracle VM Virtualbox, you would be able to see this VM, that provides the Linux-specific kernel features needed by Docker Engine.
Running Containers with Docker Toolbox
Now that Docker Toolbox is installed, containers can be run on our host. At this stage, you would be able to opt for the easier method by using Kitematic, but let’s stick to the CLI for now. Something simple like running a containerized Apache web server would look like this:
$ docker run -d -p 8080:8080 httpd
Because this is the first time we are running an Apache container, the above command will pull the Apache image from Docker hub and run it as a container in the background (-d), then mapping its internal port 8080 to the external port 8080.