Getting Started with Docker
Let's install docker:
brew update
brew install docker
If you plan to run Docker containers on your local machine and it's not Linux, then you have to install boot2docker
. The reason is that Docker sits on top of Linux kernel.
So all the Docker containers you run have access to Linux Kernel resources. boot2docker
is a lightweight Linux distribution based virtual machine(VirtualBox), made specifically to run Docker containers. It runs completely from RAM, weighs ~27MB and boots in ~5s.
brew cask install virtualbox
brew install boot2docker
Then we need to initialize boot2docker (we only have to do this once):
boot2docker init
Next, we can start up the VM.
boot2docker up
The Docker client assumes the Docker host is the current machine. We need to tell it to use our boot2docker VM by setting the DOCKER_HOST
environment variable, as well as certificate path DOCKER_CERT_PATH
and enable TLS DOCKER_TLS_VERIFY=1
:
export DOCKER_HOST=tcp://192.168.59.104:2376
export DOCKER_CERT_PATH=/Users/Vova/.boot2docker/certs/boot2docker-vm
export DOCKER_TLS_VERIFY=1
Your VM might have a different IP address—use whatever boot2docker up
told you to use.
Let's test if everything is working:
docker info
Optinally you can install Kinematic. Kitematic has one click install, which gets Docker running on your Mac and lets you control your app containers from a graphical user interface (GUI)
Resources and further reading: