Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker Machine vs Docker run

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?

like image 210
hounded Avatar asked Feb 23 '17 01:02

hounded


People also ask

What is the difference between docker run and docker start?

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.

Is docker machine still used?

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.

When would you use a docker machine?

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.

Is docker machine needed?

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.


2 Answers

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.

like image 181
BMitch Avatar answered Oct 07 '22 16:10

BMitch


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.

like image 20
VaTo Avatar answered Oct 07 '22 16:10

VaTo