As you may know from the previous post (How
I've installed Docker on Windows 7), I've just installed Docker on my
Windows. Now, if you are in my case also, and you want to create a new Docker
machine, here it is how I did it:
1. In order to create a new Docker machine via
Windows Command Prompt, you need to set the ssh.exe in your PATH environment variable. This is in
the Git\bin\ folder, which is commonly installed in C:\Program Files
or C:\Program Files(x86).So, I opened a new Command Prompt, and add ssh.exe in PATH.
Command: set PATH=%PATH%; C:\Program Files\Git\bin
2. Further, we can list the existing Docker
machines like this (we do this now, and after we add the new machine). As you can
see, I have a single Docker machine, the default one.
Command: docker-machine ls
3. Now, I will use the same virtualbox driver to create
a new machine named, my-machine.
Command: docker-machine create --driver virtualbox my-machine
4. Further, we need to connect the Docker with
this machine.
Command: docker-machine env my-machine
5. Next, get the environment commands for my-machine.
Command: docker-machine env --shell cmd my-machine
6.This points a new command as you can see in
the above picture.
Command: FOR /f "tokens=*" %i IN ('docker-machine env --shell
cmd my-machine') DO %i
7. Run the hello-world container.
Command: docker run hello-world
Done!
You can list the Docker machines again and
notice that my-machine is active and running:
You can easy stop/start the Docker machine:
Command start: docker-machine stop
my-machine
Command stop: docker-machine start
my-machine
Note: In order to see all the options for docker-machine
command try:
Command: docker-machine --help
Niciun comentariu:
Trimiteți un comentariu