Alex
Alex

Reputation: 44275

How to run docker on the Mac command line?

I have installed docker for a Mac, and in order to execute a simple test I seem to have to run all of these steps:

  1. Run docker-machine start to start the docker daemon(?)
  2. Run docker-machine env to get a list of environment settings.
  3. Run eval $(docker-machine env) to set these settings
  4. Finally you are able to run an example like docker run hello-world
  5. And you have to remember the terminal you run all of these commands, as running the same example from within a different terminal won't work.

Is that the correct way on how you start the daemon or setup the machine/terminal in order to use docker? Or is there a more easy way to do this?

Upvotes: 3

Views: 7165

Answers (1)

Matt
Matt

Reputation: 74620

It looks like you have installed Docker Toolbox rather than Docker for Mac.

Once Docker for Mac is installed it provides a more streamlined experience. The Linux VM is largely hidden from you and doesn't require VirtualBox to run.

The docker command will connect to the new VM by default without setting up the environment as the docker socket from the VM is mapped through.

→ ls -l /var/run/docker.sock 
lrwxr-xr-x  1 root  daemon  57  1 Nov 00:02 /var/run/docker.sock -> /Users/matt/Library/Containers/com.docker.docker/Data/s60

Upvotes: 3

Related Questions