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?
The run command acts like docker run -ti in that it opens an interactive terminal to the container and returns an exit status matching the exit status of the process in the container. The docker compose start command is useful only to restart containers that were previously created, but were stopped.
Docker has ended active development and support for Docker Machine. A primary method for GitLab runner autoscaling on public cloud virtual machine instances is the Runner configured with the Docker Machine executor.
The main reason you would use docker-machine is when you want to create a deployment environment for your application and manage all the micro-services running on it. For instance, you can easily have a development, staging and production environment accessible from your own machine and update them accordingly.
If you have a Linux box as your primary system, and want to run docker commands, all you need to do is download and install Docker Engine. However, if you want an efficient way to provision multiple Docker hosts on a network, in the cloud or even locally, you need Docker Machine.
You would use docker-machine if you:
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With