发布于 2015-09-10 16:22:04 | 452 次阅读 | 评论: 0 | 来源: 网络整理
Docker can run on Windows using a VM like VirtualBox. You then run Linux within the VM.
注解
Docker is still under heavy development! We don’t recommend using it in production yet, but we’re getting closer with each release. Please see our blog post, “Getting to Docker 1.0”
注解
This is a community contributed installation path. The only ‘official’ installation is using the Ubuntu installation path. This version may be out of date because it depends on some binaries to be updated and published
We recommend having at least 2Gb of free disk space and 2Gb of RAM (or more).
First open a cmd prompt. Press Windows key and then press “R” key. This will open the RUN dialog box for you. Type “cmd” and press Enter. Or you can click on Start, type “cmd” in the “Search programs and files” field, and click on cmd.exe.
This should open a cmd prompt window.
Alternatively, you can also use a Cygwin terminal, or Git Bash (or any other command line program you are usually using). The next steps would be the same.
Let’s download and run an Ubuntu image with docker binaries already installed.
git clone https://github.com/dotcloud/docker.git cd docker vagrant up
Congratulations! You are running an Ubuntu server with docker installed on it. You do not see it though, because it is running in the background.
Let’s log into your Ubuntu server now. To do so you have two choices:
Run the following command
vagrant ssh
You may see an error message starting with “ssh executable not found”. In this case it means that you do not have SSH in your PATH. If you do not have SSH in your PATH you can set it up with the “set” command. For instance, if your ssh.exe is in the folder named “C:Program Files (x86)Gitbin”, then you can run the following command:
set PATH=%PATH%;C:Program Files (x86)Gitbin
First step is to get the IP and port of your Ubuntu server. Simply run:
vagrant ssh-config
You should see an output with HostName and Port information. In this example, HostName is 127.0.0.1 and port is 2222. And the User is “vagrant”. The password is not shown, but it is also “vagrant”.
You can now use this information for connecting via SSH to your server. To do so you can:
You can download putty.exe from this page http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html Launch putty.exe and simply enter the information you got from last step.
Open, and enter user = vagrant and password = vagrant.
You can also run this command on your favorite terminal (windows prompt, cygwin, git-bash, …). Make sure to adapt the IP and port from what you got from the vagrant ssh-config command.
ssh vagrant@127.0.0.1 –p 2222
Enter user = vagrant and password = vagrant.
Congratulations, you are now logged onto your Ubuntu Server, running on top of your Windows machine !
First you have to be root in order to run docker. Simply run the following command:
sudo su
You are now ready for the docker’s “hello world” example. Run
docker run busybox echo hello world
All done!
Now you can continue with the Hello World example.
If you run into this error message “The VM failed to remain in the ‘running’ state while attempting to boot”, please check that your computer has virtualization technology available and activated by going to the BIOS. Here’s an example for an HP computer (System configuration / Device configuration)
On some machines the BIOS menu can only be accessed before startup. To access BIOS in this scenario you should restart your computer and press ESC/Enter when prompted to access the boot and BIOS controls. Typically the option to allow virtualization is contained within the BIOS/Security menu.
If you run into this error message “The program ‘docker’ is currently not installed”, try deleting the docker folder and restart from 启动Ubuntu虚拟服务器