19

I am running a Windows7 (64-bit) machine having vmplayer, which hosts Fedora 25.

I have installed docker CE on it and my examples till now have worked fine.

The issue is when trying to run docker-machine examples. As per my understanding, it is required to create hosts for docker.

  • While it makes sense to have it on Windows and Mac but do I need it on Linux?

  • What even adds to confusion is, how come all the examples I tried till now have worked fine?

  • Another point is, if docker-machine is not part of Linux docker distribution; then how do we create multiple docker hosts on Linux?

François Maturel
  • 5,884
  • 6
  • 45
  • 50
Prateek Jain
  • 2,738
  • 4
  • 28
  • 42

1 Answers1

20

Docker-machine is a tool that simplifies running docker on VMs, but it's not required in any environment if you want to manage the VM yourself. Since docker runs natively on Linux, there's no need to docker-machine to perform that install, you just install docker directly. This is what most people do with a Linux host.

If you need multiple docker hosts on Linux for some reason, you can create and manage your own VMs, e.g. virtualbox and vagrant, or you can use docker-machine as a front end on that which also handles the machine image and gives a convenient command line to switch the docker CLI between environments.

BMitch
  • 231,797
  • 42
  • 475
  • 450
  • 1
    So it's not clear what is the advantage of docker-machine and why one need it? It's somewhat like Hyper-V Management Console for VMs, but not GUI? If yes, then I do not understand why I should use `docker-machine` over `docker` if they are both cli commands and do the same things. – Suncatcher May 06 '18 at 15:44
  • 4
    @Suncatcher docker does not manage vm's, it's not a vm itself, it's a tool to run isolated applications on the same kernel. If you need a vm, there's D4W, D4M, or the more general docker-machine tool. – BMitch May 06 '18 at 18:33
  • One reason you might want to do this is to provide a security sandbox for a docker container that mounts /var/run/docker.sock. On an unsandboxed docker install, such a container can access your whole hard disk as root, but if the docker daemon is running in a VM, containers that perform this exploit will only have access to the VM filesystem. – MatrixManAtYrService Sep 18 '20 at 18:45
  • 1
    @MatrixManAtYrService for that use case, you may want to look at the rootless project to start a daemon as a single user. It's been several years since this was asked and docker-machine looks like it's moving towards a legacy state, not receiving much attention from Docker these days. – BMitch Sep 18 '20 at 19:11