Start with Mac
Installation
To start Docker with Mac, you need to install Docker Toolbox.
Once you install the Docker Toolbox, then you should be able to start the Docker Quickstart Terminal by this:
bash --login '/Applications/Docker/Docker Quickstart Terminal.app/Contents/Resources/Scripts/start.sh'
You can check the version by this:
docker version
The output should show the versions of both--client and server--like this:
Client:
Version: 1.10.3
API version: 1.22
Go version: go1.5.3
Git commit: 20f81dd
Built: Thu Mar 10 21:49:11 2016
OS/Arch: darwin/amd64
Server:
Version: 1.10.3
API version: 1.22
Go version: go1.5.3
Git commit: 20f81dd
Built: Thu Mar 10 21:49:11 2016
OS/Arch: linux/amd64
Where is the docker server running?
The docker server is running not on the Mac OS X, but on a virtual machine on VirtualBox.
The name of the VM should be default. You can check the ip with this:
docker-machine ip
You can even login to the VM with this:
docker-machine ssh
Pull a ubuntu image:
docker pull ubuntu
Show the image list:
docker images
Delete an image:
docker rmi <image>
Print Hello World on a container:
docker run ubuntu /bin/echo 'Hello world'
Run use Bash interactively on a container:
docker run -i -t ubuntu /bin/bash
Show the list of containers:
docker ps -a
Delete a container::
docker rm <container>
Run a container as daemon:
docker run -d -t ubuntu
Connect to the console of a container:
docker exec -i -t <CONTAINER_ID> bash