问题
I'm confused between docker-machine vs docker run
docker images, shows me my images and then I can run one of these images with docker run.
When do I need to use docker-machine?
回答1:
From Docker Documentation
You can use Docker Machine to:
- Install and run Docker on Mac or Windows
- Provision and manage multiple remote Docker hosts
- Provision Swarm clusters
in other words:
when your Host OS does not support running Docker Engine natively (i.e. on Mac and Windows).
and basically docker run is to start a container based on a docker image either from a local image or from the online registry.
回答2:
You would use docker-machine if you:
- Have a VirtualBox based install of Docker for Win/Mac, rather than the newer HyperV or xhyve releases.
- Have machines in the cloud that you'd like to manage from docker-machine
docker-machine includes boot2docker images to do an install and it acts as a wrapper to setting the docker environment variables to point the client to a remote host. You can easily do that latter part by hand.
Docker itself is what runs the containers, so if you're able to do that without docker-machine, you probably don't need to complicate your toolset.
来源:https://stackoverflow.com/questions/42405238/docker-machine-vs-docker-run