Stranice

Thursday 27 August 2015

docker-machine on Windows 7 x64

I suppose you would like to use Docker toolbox on Windows 7 x64.
Boot2Docker is deprecated and new way of using Docker on Windows is docker-machine command.

If you are following official documentation they use one very cool command that sets environment variables in your shell automatically eval "$(docker-machine env machine-name)".
And then you get an error:
'eval' is not recognized as an internal or external command,
operable program or batch file.

Well, you think that there must be a command that is not on the path.
Unfortunately this is not also the case.

Uh, another linux on the Windows system.

Solution is quite simple.
1. Install Git for windows (include Unix tools) and run command prompt
    Be sure to enable PATH for git commands  
2. run sh -li (interactive shell)
3. your command line will change into linux shell
4. run above mentioned command:
    eval "$(docker-machine env machine-name)"

I have found out that usually there are usually some missing steps in the tutorials.

Well, well, something is missing here.
It seems that machine name is missing..

Ok, here is complete example from creating a new machine and connecting to it.

1. c:\Users\Name\sh -li (runs shell)
2. Name@Computer-Name ~ docker-machine create --driver virtualbox dev
3. Name@Computer-Name ~ eval "$(docker-machine env dev)"

Now your console is ready to use docker command on dev machine

2 comments:

  1. I get this when following steps above:

    $ eval "$(docker-machine env default)"
    sh: You: command not found
    sh: SET: command not found
    sh: SET: command not found
    sh: SET: command not found
    sh: SET: command not found
    sh: REM: command not found
    sh: syntax error near unexpected token `('

    Any ideas?

    ReplyDelete
    Replies
    1. I don't know.
      I have just tested with new docker-toolbox 1.10 and it works fine.

      Delete