stephzcj
stephzcj

Reputation: 725

the command "docker-machine ls " list nothing on my mac

I installed the latest stable docker for Mac, and started the docker directly without a virtual box. I know that it must have started a virtual box, so I use "docker-machine ls" to find the default machine, but it list nothing. How can i find the virtual machine? My OS version is 10.10.5 PS: In fact, I didn't create any virtual machines, but do run my spring-boot app on the "alpine-oraclejdk8" image, so does that mean I exactly using the docker? And the reason I want to find the virtual machine is I used "nsenter" to enter the container to debug the log of my app but it doesn't work(the writer of "nsenter" told that I need enter the virtual machine first). So this is my confusing point that how the docker is running but I cant find the virtual machine on MAC

Upvotes: 2

Views: 2251

Answers (2)

programmerq
programmerq

Reputation: 6534

Docker for mac does not use docker-machine. The app that runs and give you the little whale icon in the top menu bar runs its own virtual machine. This virtual machine uses hyperkit, which is a project that uses xhyve, which is a port of bhyve to the mac os darwin kernel.

This will not create any entries to make docker-machine aware of the vm.

Rather than using nsenter to enter your container, you should use the docker exec command instead. The advantage of using docker exec is that it works without having the first ssh to where docker is running.

Upvotes: 1

Vlad
Vlad

Reputation: 9481

Because you need to create it.

Run the command

docker-machine create vm1

And you'll have your machine.

To redirect your docker client to the specific machine use this command

eval $(docker-machine env vm1)

Where 'vm1' is the same 'vm1' name that you used to create the machine. You can have a number of docker machine running at the same time using various backends like virtualbox or aws

Upvotes: 0

Related Questions