Hacking Gate

ERU

To dream and to build, To fail and to succeed.


Helloworld docker on osx without boot2docker

Install Docker on OSX

brew search docker

There's too many search results, which one should I choose?

'boot2docker' is officially deprecated
in favor of 'docker-machine'

Install these following at least.

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://%2Fvar%2Frun%2Fdocker.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?

Hello from Docker

Create default Docker VM.

docker-machine create --driver virtualbox default

Make sure 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

Error message should gone.

Run ubuntu bash

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

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.
comments powered by Disqus