2

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

stephzcj
  • 695
  • 1
  • 6
  • 9

2 Answers2

1

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.

programmerq
  • 6,262
  • 25
  • 40
  • YEAH, I also find the explain in official DOC ..thanks a lot. For the point of how to enter the container is that I deployed my app to the "alpine-oraclejdk8:slim" image which does not have bash. I don't know what I can do without bash if I just use docker exec or docker attach to enter the container .That's why I choose "nsenter".....finally I had to install a virtualbox with boot2docker and connect docker to the machine....T T – stephzcj May 18 '17 at 01:24
0

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

Vlad
  • 9,180
  • 5
  • 48
  • 67
  • every machine created by docker-machine will be running docker host. The docker command will connect to the machine you select. – Vlad May 17 '17 at 03:16
  • but it's so weird that I started the docker first, then create a virtual-machine...so can docker run on mac BEFORE I create a virtual-machine? – stephzcj May 17 '17 at 03:23
  • docker-machine is not docker, it's just a bunch of script to create virtual machines that will run docker. The docker command you are running on your MacOS shell is just a client, it doesn't need any docker to run – Vlad May 17 '17 at 03:58
  • yeah, I know what u means. 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 – stephzcj May 17 '17 at 06:25