dockerdocker-machinedocker-toolboxdocker-for-mac

What's the relationship among "Docker Toolbox", "docker-machine" and "Docker Container"


I am totally new to docker and recently I follow "The Docker Book" from James to learn about docker by myself. The OS I am using is OSX. The tool I am using to run docker is Docker Desktop for Mac (BTW, Is that a docker-toolbox I am using?).

When I follow the book to run the following code:

$ sudo  docker run --log-driver="syslog" --name daemon_dwayne -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done"

The terminal returns:

docker: Error response from daemon: failed to initialize logging driver: Unix syslog delivery error.

So I tried to use docker-machine ssh to connect to the Docker Toolbox VM, but the terminal returns:

Error: No machine name(s) specified and no "default" machine exists

After that I downloaded the Boot2Docker iso file and successfully created a docker-machine named "dev".

So I think clarify these concepts would be helpful:

I thought the "Docker toolbox" is a software running on Mac/PC that contains a Linux VM. So that we can create "Docker containers" on that VM.

But what is "docker-machine"? And what's the relationship between a "docker-machine" and that "Linux VM" running on my OS?

Could anyone please help me with these concepts?


Solution

  • Docker Toolbox, (DT for short) is the Docker package (or "software") that is now superseded by Docker Desktop (DD) (for Win or Mac). You don't need (or probably shouldn't have at all, DT installed at the same time as DD. It may or may not cause conflicts, I'm not sure.).

    DT creates upon installation a default VM via VirtualBox; if you didn't do a full install of DT that's why you don't have a 'default machine'. The Boot2docker.iso is also part of DT, but not DD.

    docker container is just a command in docker to manage your containers. "docker" being the executable program itself, while "container" is on of it's arguments. Do a docker container --help for more details.

    docker-machine is the executable program that is part of DT; but not part of DD. Once you remove the older DT you no longer need to use any docker-machine calls, as those are now all available via different commands in DD.

    Regarding your error, have a look at :

    https://docs.docker.com/config/containers/logging/configure/

    You may also want to give docker exec a try in this case as well, if you're just wanting to fire off some simple commands:

    https://docs.docker.com/engine/reference/commandline/exec/

    I know it's a lot to absorb at first, and confusing; I'm about a year and a half in myself and remember the same confusion, but once you get the hang of it it's pretty easy, and very cool. =)