- Published on
Helloworld docker on OS X without boot2docker
- Authors
- Name
- Tong
2019 Update
I suggest to install GUI version of Docker in brew cask
instead CLI version in brew
.
brew cask install docker
Install cli Docker on OS X
brew search docker
There's too many search results, which one should I choose?
'boot2docker' is officially deprecated in favor of 'docker-machine'
So, Install the following.
brew install docker
brew install docker-machine
brew install Caskroom/cask/virtualbox
Trying to run hello-world
docker run hello-world
I got this error message
Post http://var/run/docker.sock/v1.20/containers/create: dial unix /var/run/docker.sock: connect: no such file or directory.
* Are you trying to connect to a TLS-enabled daemon without TLS?
* Is your docker daemon up and running?
Create a machine
We'll use virtualbox
in this tutorial. (vmwarefusion
and xhyve
driver are also available)
Create default Docker VM.
docker-machine create --driver virtualbox default
To see if default
is running.
docker-machine ls
Get the environment from default
.
docker-machine env default
Connect your shell to the default
machine.
eval "$(docker-machine env default)"
Then run hello-world
docker run hello-world
Run ubuntu bash in Docker
docker run -it ubuntu bash
This will automaticaly download a ubuntu image, please wait.
uname -a
Linux d04026aedb7e 4.0.9-boot2docker #1 SMP Thu Sep 10 20:39:20 UTC 2015 x8664 x8664 x86_64 GNU/Linux
Start & Stop command
docker-machine start default
docker-machine stop default
docker-machine restart default
Several Docker commands
docker images
- List images.docker ps -l
- Lists containers.docker logs
- Shows us the standard output of a container.docker stop
- Stops running containers.docker rm
- Remove containers.docker rmi
- Remove images.
View on GitHub • This article is licensed under a CC BY-SA 4.0 license.