Look at Docker Installation or if you already have VirtualBox and Homebrew installed:
`brew update && brew install docker`
Docker runs in a Linux VM on OSX. A Docker client runs on your host machine to control Docker containers in the VM. The boot2docker
command controls that VM and provides information about it. You can issue the command without any arguments to see a list of available sub-commands.
boot2docker
You can start the VM and set the appropriate DOCKER_HOST
environment variable with:
boot2docker up && $(boot2docker shellinit)
Docker extends the functionality of lxc (linux containers). The improvements are best described here: Stackoverflow: What does Docker add to just plain LXC
Below are some example commands.
docker
docker run --help
The default command for this container is bash. Once in there, run top
to see what is running. Type exit
and hit enter to quit the container.
docker run -it --rm ubuntu
This will output the Ubuntu release information. When a container's command is finished it will stop automatically.
docker run -it --rm ubuntu cat /etc/lsb-release
mkdir docker-test
cd docker-test
echo 'FROM tutum/lamp:latest' > Dockerfile
docker build -t my-image .
cd ..
docker run -d -p 8080:80 --name my-container my-image
Find your VM ip with:
boot2docker ip
Now use this IP to access your container in a browser. Something like:
http://192.168.59.103:8080
docker stop my-container
docker rm my-container
or
docker rm -f my-container