This removes the Vagrantfile and updates the documentation to remove
the steps which explain how to install Docker in a VM via Vagrant.
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
| ... | ... |
@@ -6,4 +6,3 @@ Michael Crosby <michael@crosbymichael.com> (@crosbymichael) |
| 6 | 6 |
api.go: Victor Vieux <victor@dotcloud.com> (@vieux) |
| 7 | 7 |
Dockerfile: Tianon Gravi <admwiggin@gmail.com> (@tianon) |
| 8 | 8 |
Makefile: Tianon Gravi <admwiggin@gmail.com> (@tianon) |
| 9 |
-Vagrantfile: Cristian Staretu <cristian.staretu@gmail.com> (@unclejack) |
| 10 | 9 |
deleted file mode 100644 |
| ... | ... |
@@ -1,206 +0,0 @@ |
| 1 |
-# -*- mode: ruby -*- |
|
| 2 |
-# vi: set ft=ruby : |
|
| 3 |
- |
|
| 4 |
-BOX_NAME = ENV['BOX_NAME'] || "ubuntu" |
|
| 5 |
-BOX_URI = ENV['BOX_URI'] || "http://files.vagrantup.com/precise64.box" |
|
| 6 |
-VF_BOX_URI = ENV['BOX_URI'] || "http://files.vagrantup.com/precise64_vmware_fusion.box" |
|
| 7 |
-AWS_BOX_URI = ENV['BOX_URI'] || "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box" |
|
| 8 |
-AWS_REGION = ENV['AWS_REGION'] || "us-east-1" |
|
| 9 |
-AWS_AMI = ENV['AWS_AMI'] || "ami-69f5a900" |
|
| 10 |
-AWS_INSTANCE_TYPE = ENV['AWS_INSTANCE_TYPE'] || 't1.micro' |
|
| 11 |
-SSH_PRIVKEY_PATH = ENV['SSH_PRIVKEY_PATH'] |
|
| 12 |
-PRIVATE_NETWORK = ENV['PRIVATE_NETWORK'] |
|
| 13 |
- |
|
| 14 |
-# Boolean that forwards the Docker dynamic ports 49000-49900 |
|
| 15 |
-# See http://docs.docker.io/en/latest/use/port_redirection/ for more |
|
| 16 |
-# $ FORWARD_DOCKER_PORTS=1 vagrant [up|reload] |
|
| 17 |
-FORWARD_DOCKER_PORTS = ENV['FORWARD_DOCKER_PORTS'] |
|
| 18 |
-VAGRANT_RAM = ENV['VAGRANT_RAM'] || 512 |
|
| 19 |
-VAGRANT_CORES = ENV['VAGRANT_CORES'] || 1 |
|
| 20 |
- |
|
| 21 |
-# You may also provide a comma-separated list of ports |
|
| 22 |
-# for Vagrant to forward. For example: |
|
| 23 |
-# $ FORWARD_PORTS=8080,27017 vagrant [up|reload] |
|
| 24 |
-FORWARD_PORTS = ENV['FORWARD_PORTS'] |
|
| 25 |
- |
|
| 26 |
-# A script to upgrade from the 12.04 kernel to the raring backport kernel (3.8) |
|
| 27 |
-# and install docker. |
|
| 28 |
-$script = <<SCRIPT |
|
| 29 |
-# The username to add to the docker group will be passed as the first argument |
|
| 30 |
-# to the script. If nothing is passed, default to "vagrant". |
|
| 31 |
-user="$1" |
|
| 32 |
-if [ -z "$user" ]; then |
|
| 33 |
- user=vagrant |
|
| 34 |
-fi |
|
| 35 |
- |
|
| 36 |
-# Enable memory cgroup and swap accounting |
|
| 37 |
-sed -i 's/GRUB_CMDLINE_LINUX=""/GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"/g' /etc/default/grub |
|
| 38 |
-update-grub |
|
| 39 |
- |
|
| 40 |
-# Adding an apt gpg key is idempotent. |
|
| 41 |
-apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 |
|
| 42 |
- |
|
| 43 |
-# Creating the docker.list file is idempotent, but it may overwrite desired |
|
| 44 |
-# settings if it already exists. This could be solved with md5sum but it |
|
| 45 |
-# doesn't seem worth it. |
|
| 46 |
-echo 'deb http://get.docker.io/ubuntu docker main' > \ |
|
| 47 |
- /etc/apt/sources.list.d/docker.list |
|
| 48 |
- |
|
| 49 |
-# Update remote package metadata. 'apt-get update' is idempotent. |
|
| 50 |
-apt-get update -q |
|
| 51 |
- |
|
| 52 |
-# Install docker. 'apt-get install' is idempotent. |
|
| 53 |
-apt-get install -q -y lxc-docker |
|
| 54 |
- |
|
| 55 |
-usermod -a -G docker "$user" |
|
| 56 |
- |
|
| 57 |
-tmp=`mktemp -q` && {
|
|
| 58 |
- # Only install the backport kernel, don't bother upgrading if the backport is |
|
| 59 |
- # already installed. We want parse the output of apt so we need to save it |
|
| 60 |
- # with 'tee'. NOTE: The installation of the kernel will trigger dkms to |
|
| 61 |
- # install vboxguest if needed. |
|
| 62 |
- apt-get install -q -y --no-upgrade linux-image-generic-lts-raring | \ |
|
| 63 |
- tee "$tmp" |
|
| 64 |
- |
|
| 65 |
- # Parse the number of installed packages from the output |
|
| 66 |
- NUM_INST=`awk '$2 == "upgraded," && $4 == "newly" { print $3 }' "$tmp"`
|
|
| 67 |
- rm "$tmp" |
|
| 68 |
-} |
|
| 69 |
- |
|
| 70 |
-# If the number of installed packages is greater than 0, we want to reboot (the |
|
| 71 |
-# backport kernel was installed but is not running). |
|
| 72 |
-if [ "$NUM_INST" -gt 0 ]; |
|
| 73 |
-then |
|
| 74 |
- echo "Rebooting down to activate new kernel." |
|
| 75 |
- echo "/vagrant will not be mounted. Use 'vagrant halt' followed by" |
|
| 76 |
- echo "'vagrant up' to ensure /vagrant is mounted." |
|
| 77 |
- shutdown -r now |
|
| 78 |
-fi |
|
| 79 |
-SCRIPT |
|
| 80 |
- |
|
| 81 |
-# We need to install the virtualbox guest additions *before* we do the normal |
|
| 82 |
-# docker installation. As such this script is prepended to the common docker |
|
| 83 |
-# install script above. This allows the install of the backport kernel to |
|
| 84 |
-# trigger dkms to build the virtualbox guest module install. |
|
| 85 |
-$vbox_script = <<VBOX_SCRIPT + $script |
|
| 86 |
-# Install the VirtualBox guest additions if they aren't already installed. |
|
| 87 |
-if [ ! -d /opt/VBoxGuestAdditions-4.3.6/ ]; then |
|
| 88 |
- # Update remote package metadata. 'apt-get update' is idempotent. |
|
| 89 |
- apt-get update -q |
|
| 90 |
- |
|
| 91 |
- # Kernel Headers and dkms are required to build the vbox guest kernel |
|
| 92 |
- # modules. |
|
| 93 |
- apt-get install -q -y linux-headers-generic-lts-raring dkms |
|
| 94 |
- |
|
| 95 |
- echo 'Downloading VBox Guest Additions...' |
|
| 96 |
- wget -cq http://dlc.sun.com.edgesuite.net/virtualbox/4.3.6/VBoxGuestAdditions_4.3.6.iso |
|
| 97 |
- echo "95648fcdb5d028e64145a2fe2f2f28c946d219da366389295a61fed296ca79f0 VBoxGuestAdditions_4.3.6.iso" | sha256sum --check || exit 1 |
|
| 98 |
- |
|
| 99 |
- mount -o loop,ro /home/vagrant/VBoxGuestAdditions_4.3.6.iso /mnt |
|
| 100 |
- /mnt/VBoxLinuxAdditions.run --nox11 |
|
| 101 |
- umount /mnt |
|
| 102 |
-fi |
|
| 103 |
-VBOX_SCRIPT |
|
| 104 |
- |
|
| 105 |
-Vagrant::Config.run do |config| |
|
| 106 |
- # Setup virtual machine box. This VM configuration code is always executed. |
|
| 107 |
- config.vm.box = BOX_NAME |
|
| 108 |
- config.vm.box_url = BOX_URI |
|
| 109 |
- |
|
| 110 |
- # Use the specified private key path if it is specified and not empty. |
|
| 111 |
- if SSH_PRIVKEY_PATH |
|
| 112 |
- config.ssh.private_key_path = SSH_PRIVKEY_PATH |
|
| 113 |
- end |
|
| 114 |
- |
|
| 115 |
- config.ssh.forward_agent = true |
|
| 116 |
-end |
|
| 117 |
- |
|
| 118 |
-# Providers were added on Vagrant >= 1.1.0 |
|
| 119 |
-# |
|
| 120 |
-# NOTE: The vagrant "vm.provision" appends its arguments to a list and executes |
|
| 121 |
-# them in order. If you invoke "vm.provision :shell, :inline => $script" |
|
| 122 |
-# twice then vagrant will run the script two times. Unfortunately when you use |
|
| 123 |
-# providers and the override argument to set up provisioners (like the vbox |
|
| 124 |
-# guest extensions) they 1) don't replace the other provisioners (they append |
|
| 125 |
-# to the end of the list) and 2) you can't control the order the provisioners |
|
| 126 |
-# are executed (you can only append to the list). If you want the virtualbox |
|
| 127 |
-# only script to run before the other script, you have to jump through a lot of |
|
| 128 |
-# hoops. |
|
| 129 |
-# |
|
| 130 |
-# Here is my only repeatable solution: make one script that is common ($script) |
|
| 131 |
-# and another script that is the virtual box guest *prepended* to the common |
|
| 132 |
-# script. Only ever use "vm.provision" *one time* per provider. That means |
|
| 133 |
-# every single provider has an override, and every single one configures |
|
| 134 |
-# "vm.provision". Much saddness, but such is life. |
|
| 135 |
-Vagrant::VERSION >= "1.1.0" and Vagrant.configure("2") do |config|
|
|
| 136 |
- config.vm.provider :aws do |aws, override| |
|
| 137 |
- username = "ubuntu" |
|
| 138 |
- override.vm.box_url = AWS_BOX_URI |
|
| 139 |
- override.vm.provision :shell, :inline => $script, :args => username |
|
| 140 |
- aws.access_key_id = ENV["AWS_ACCESS_KEY"] |
|
| 141 |
- aws.secret_access_key = ENV["AWS_SECRET_KEY"] |
|
| 142 |
- aws.keypair_name = ENV["AWS_KEYPAIR_NAME"] |
|
| 143 |
- override.ssh.username = username |
|
| 144 |
- aws.region = AWS_REGION |
|
| 145 |
- aws.ami = AWS_AMI |
|
| 146 |
- aws.instance_type = AWS_INSTANCE_TYPE |
|
| 147 |
- end |
|
| 148 |
- |
|
| 149 |
- config.vm.provider :rackspace do |rs, override| |
|
| 150 |
- override.vm.provision :shell, :inline => $script |
|
| 151 |
- rs.username = ENV["RS_USERNAME"] |
|
| 152 |
- rs.api_key = ENV["RS_API_KEY"] |
|
| 153 |
- rs.public_key_path = ENV["RS_PUBLIC_KEY"] |
|
| 154 |
- rs.flavor = /512MB/ |
|
| 155 |
- rs.image = /Ubuntu/ |
|
| 156 |
- end |
|
| 157 |
- |
|
| 158 |
- config.vm.provider :vmware_fusion do |f, override| |
|
| 159 |
- override.vm.box_url = VF_BOX_URI |
|
| 160 |
- override.vm.synced_folder ".", "/vagrant", disabled: true |
|
| 161 |
- override.vm.provision :shell, :inline => $script |
|
| 162 |
- f.vmx["displayName"] = "docker" |
|
| 163 |
- end |
|
| 164 |
- |
|
| 165 |
- config.vm.provider :virtualbox do |vb, override| |
|
| 166 |
- override.vm.provision :shell, :inline => $vbox_script |
|
| 167 |
- vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] |
|
| 168 |
- vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"] |
|
| 169 |
- vb.customize ["modifyvm", :id, "--memory", VAGRANT_RAM] |
|
| 170 |
- vb.customize ["modifyvm", :id, "--cpus", VAGRANT_CORES] |
|
| 171 |
- end |
|
| 172 |
-end |
|
| 173 |
- |
|
| 174 |
-# If this is a version 1 config, virtualbox is the only option. A version 2 |
|
| 175 |
-# config would have already been set in the above provider section. |
|
| 176 |
-Vagrant::VERSION < "1.1.0" and Vagrant::Config.run do |config| |
|
| 177 |
- config.vm.provision :shell, :inline => $vbox_script |
|
| 178 |
-end |
|
| 179 |
- |
|
| 180 |
-# Setup port forwarding per loaded environment variables |
|
| 181 |
-forward_ports = FORWARD_DOCKER_PORTS.nil? ? [] : [*49153..49900] |
|
| 182 |
-forward_ports += FORWARD_PORTS.split(',').map{|i| i.to_i } if FORWARD_PORTS
|
|
| 183 |
-if forward_ports.any? |
|
| 184 |
- Vagrant::VERSION < "1.1.0" and Vagrant::Config.run do |config| |
|
| 185 |
- forward_ports.each do |port| |
|
| 186 |
- config.vm.forward_port port, port |
|
| 187 |
- end |
|
| 188 |
- end |
|
| 189 |
- |
|
| 190 |
- Vagrant::VERSION >= "1.1.0" and Vagrant.configure("2") do |config|
|
|
| 191 |
- forward_ports.each do |port| |
|
| 192 |
- config.vm.network :forwarded_port, :host => port, :guest => port, auto_correct: true |
|
| 193 |
- end |
|
| 194 |
- end |
|
| 195 |
-end |
|
| 196 |
- |
|
| 197 |
-if !PRIVATE_NETWORK.nil? |
|
| 198 |
- Vagrant::VERSION < "1.1.0" and Vagrant::Config.run do |config| |
|
| 199 |
- config.vm.network :hostonly, PRIVATE_NETWORK |
|
| 200 |
- end |
|
| 201 |
- |
|
| 202 |
- Vagrant::VERSION >= "1.1.0" and Vagrant.configure("2") do |config|
|
|
| 203 |
- config.vm.network "private_network", ip: PRIVATE_NETWORK |
|
| 204 |
- end |
|
| 205 |
-end |
|
| 206 |
- |
| ... | ... |
@@ -92,14 +92,6 @@ To execute the test cases, run this command: |
| 92 | 92 |
|
| 93 | 93 |
sudo make test |
| 94 | 94 |
|
| 95 |
- |
|
| 96 |
-Note: if you're running the tests in vagrant, you need to specify a dns entry in |
|
| 97 |
-the command (either edit the Makefile, or run the step manually): |
|
| 98 |
- |
|
| 99 |
-.. code-block:: bash |
|
| 100 |
- |
|
| 101 |
- sudo docker run -dns 8.8.8.8 -privileged -v `pwd`:/go/src/github.com/dotcloud/docker docker hack/make.sh test |
|
| 102 |
- |
|
| 103 | 95 |
If the test are successful then the tail of the output should look something like this |
| 104 | 96 |
|
| 105 | 97 |
.. code-block:: bash |
| ... | ... |
@@ -25,9 +25,9 @@ Does Docker run on Mac OS X or Windows? |
| 25 | 25 |
|
| 26 | 26 |
Not at this time, Docker currently only runs on Linux, but you can |
| 27 | 27 |
use VirtualBox to run Docker in a virtual machine on your box, and |
| 28 |
- get the best of both worlds. Check out the |
|
| 29 |
- :ref:`macosx` and :ref:`windows` installation |
|
| 30 |
- guides. |
|
| 28 |
+ get the best of both worlds. Check out the :ref:`macosx` and |
|
| 29 |
+ :ref:`windows` installation guides. The small Linux distribution boot2docker |
|
| 30 |
+ can be run inside virtual machines on these two operating systems. |
|
| 31 | 31 |
|
| 32 | 32 |
How do containers compare to virtual machines? |
| 33 | 33 |
.............................................. |
| ... | ... |
@@ -24,6 +24,6 @@ For a high-level overview of Docker, please see the `Introduction |
| 24 | 24 |
Docker, we have a `quick start <http://www.docker.io/gettingstarted>`_ |
| 25 | 25 |
and a more in-depth guide to :ref:`ubuntu_linux` and other |
| 26 | 26 |
:ref:`installation_list` paths including prebuilt binaries, |
| 27 |
-Vagrant-created VMs, Rackspace and Amazon instances. |
|
| 27 |
+Rackspace and Amazon instances. |
|
| 28 | 28 |
|
| 29 | 29 |
Enough reading! :ref:`Try it out! <running_examples>` |
| ... | ... |
@@ -10,8 +10,7 @@ Amazon EC2 |
| 10 | 10 |
There are several ways to install Docker on AWS EC2: |
| 11 | 11 |
|
| 12 | 12 |
* :ref:`amazonquickstart` or |
| 13 |
-* :ref:`amazonstandard` or |
|
| 14 |
-* :ref:`amazonvagrant` |
|
| 13 |
+* :ref:`amazonstandard` |
|
| 15 | 14 |
|
| 16 | 15 |
**You'll need an** `AWS account <http://aws.amazon.com/>`_ **first, of course.** |
| 17 | 16 |
|
| ... | ... |
@@ -73,112 +72,4 @@ running Ubuntu. Just follow Step 1 from :ref:`amazonquickstart` to |
| 73 | 73 |
pick an image (or use one of your own) and skip the step with the |
| 74 | 74 |
*User Data*. Then continue with the :ref:`ubuntu_linux` instructions. |
| 75 | 75 |
|
| 76 |
-.. _amazonvagrant: |
|
| 77 |
- |
|
| 78 |
-Use Vagrant |
|
| 79 |
- |
|
| 80 |
-.. include:: install_unofficial.inc |
|
| 81 |
- |
|
| 82 |
-And finally, if you prefer to work through Vagrant, you can install |
|
| 83 |
-Docker that way too. Vagrant 1.1 or higher is required. |
|
| 84 |
- |
|
| 85 |
-1. Install vagrant from http://www.vagrantup.com/ (or use your package manager) |
|
| 86 |
-2. Install the vagrant aws plugin |
|
| 87 |
- |
|
| 88 |
- :: |
|
| 89 |
- |
|
| 90 |
- vagrant plugin install vagrant-aws |
|
| 91 |
- |
|
| 92 |
- |
|
| 93 |
-3. Get the docker sources, this will give you the latest Vagrantfile. |
|
| 94 |
- |
|
| 95 |
- :: |
|
| 96 |
- |
|
| 97 |
- git clone https://github.com/dotcloud/docker.git |
|
| 98 |
- |
|
| 99 |
- |
|
| 100 |
-4. Check your AWS environment. |
|
| 101 |
- |
|
| 102 |
- Create a keypair specifically for EC2, give it a name and save it |
|
| 103 |
- to your disk. *I usually store these in my ~/.ssh/ folder*. |
|
| 104 |
- |
|
| 105 |
- Check that your default security group has an inbound rule to |
|
| 106 |
- accept SSH (port 22) connections. |
|
| 107 |
- |
|
| 108 |
-5. Inform Vagrant of your settings |
|
| 109 |
- |
|
| 110 |
- Vagrant will read your access credentials from your environment, so |
|
| 111 |
- we need to set them there first. Make sure you have everything on |
|
| 112 |
- amazon aws setup so you can (manually) deploy a new image to EC2. |
|
| 113 |
- |
|
| 114 |
- Note that where possible these variables are the same as those honored by |
|
| 115 |
- the ec2 api tools. |
|
| 116 |
- :: |
|
| 117 |
- |
|
| 118 |
- export AWS_ACCESS_KEY=xxx |
|
| 119 |
- export AWS_SECRET_KEY=xxx |
|
| 120 |
- export AWS_KEYPAIR_NAME=xxx |
|
| 121 |
- export SSH_PRIVKEY_PATH=xxx |
|
| 122 |
- |
|
| 123 |
- export BOX_NAME=xxx |
|
| 124 |
- export AWS_REGION=xxx |
|
| 125 |
- export AWS_AMI=xxx |
|
| 126 |
- export AWS_INSTANCE_TYPE=xxx |
|
| 127 |
- |
|
| 128 |
- The required environment variables are: |
|
| 129 |
- |
|
| 130 |
- * ``AWS_ACCESS_KEY`` - The API key used to make requests to AWS |
|
| 131 |
- * ``AWS_SECRET_KEY`` - The secret key to make AWS API requests |
|
| 132 |
- * ``AWS_KEYPAIR_NAME`` - The name of the keypair used for this EC2 instance |
|
| 133 |
- * ``SSH_PRIVKEY_PATH`` - The path to the private key for the named |
|
| 134 |
- keypair, for example ``~/.ssh/docker.pem`` |
|
| 135 |
- |
|
| 136 |
- There are a number of optional environment variables: |
|
| 137 |
- |
|
| 138 |
- * ``BOX_NAME`` - The name of the vagrant box to use. Defaults to |
|
| 139 |
- ``ubuntu``. |
|
| 140 |
- * ``AWS_REGION`` - The aws region to spawn the vm in. Defaults to |
|
| 141 |
- ``us-east-1``. |
|
| 142 |
- * ``AWS_AMI`` - The aws AMI to start with as a base. This must be |
|
| 143 |
- be an ubuntu 12.04 precise image. You must change this value if |
|
| 144 |
- ``AWS_REGION`` is set to a value other than ``us-east-1``. |
|
| 145 |
- This is because AMIs are region specific. Defaults to ``ami-69f5a900``. |
|
| 146 |
- * ``AWS_INSTANCE_TYPE`` - The aws instance type. Defaults to ``t1.micro``. |
|
| 147 |
- |
|
| 148 |
- You can check if they are set correctly by doing something like |
|
| 149 |
- |
|
| 150 |
- :: |
|
| 151 |
- |
|
| 152 |
- echo $AWS_ACCESS_KEY |
|
| 153 |
- |
|
| 154 |
-6. Do the magic! |
|
| 155 |
- |
|
| 156 |
- :: |
|
| 157 |
- |
|
| 158 |
- vagrant up --provider=aws |
|
| 159 |
- |
|
| 160 |
- |
|
| 161 |
- If it stalls indefinitely on ``[default] Waiting for SSH to become |
|
| 162 |
- available...``, Double check your default security zone on AWS |
|
| 163 |
- includes rights to SSH (port 22) to your container. |
|
| 164 |
- |
|
| 165 |
- If you have an advanced AWS setup, you might want to have a look at |
|
| 166 |
- `vagrant-aws <https://github.com/mitchellh/vagrant-aws>`_. |
|
| 167 |
- |
|
| 168 |
-7. Connect to your machine |
|
| 169 |
- |
|
| 170 |
- .. code-block:: bash |
|
| 171 |
- |
|
| 172 |
- vagrant ssh |
|
| 173 |
- |
|
| 174 |
-8. Your first command |
|
| 175 |
- |
|
| 176 |
- Now you are in the VM, run docker |
|
| 177 |
- |
|
| 178 |
- .. code-block:: bash |
|
| 179 |
- |
|
| 180 |
- sudo docker |
|
| 181 |
- |
|
| 182 |
- |
|
| 183 | 76 |
Continue with the :ref:`hello_world` example. |
| ... | ... |
@@ -1,223 +1,72 @@ |
| 1 | 1 |
:title: Installation on Windows |
| 2 | 2 |
:description: Please note this project is currently under heavy development. It should not be used in production. |
| 3 |
-:keywords: Docker, Docker documentation, Windows, requirements, virtualbox, vagrant, git, ssh, putty, cygwin |
|
| 3 |
+:keywords: Docker, Docker documentation, Windows, requirements, virtualbox, boot2docker |
|
| 4 | 4 |
|
| 5 | 5 |
.. _windows: |
| 6 | 6 |
|
| 7 | 7 |
Windows |
| 8 | 8 |
======= |
| 9 | 9 |
|
| 10 |
-Docker can run on Windows using a VM like VirtualBox. You then run |
|
| 11 |
-Linux within the VM. |
|
| 10 |
+Docker can run on Windows using a virtualization platform like VirtualBox. A Linux |
|
| 11 |
+distribution is run inside a virtual machine and that's where Docker will run. |
|
| 12 | 12 |
|
| 13 | 13 |
Installation |
| 14 | 14 |
------------ |
| 15 | 15 |
|
| 16 | 16 |
.. include:: install_header.inc |
| 17 | 17 |
|
| 18 |
-.. include:: install_unofficial.inc |
|
| 18 |
+1. Install virtualbox from https://www.virtualbox.org - or follow this `tutorial <http://www.slideshare.net/julienbarbier42/install-virtualbox-on-windows-7>`_. |
|
| 19 | 19 |
|
| 20 |
-1. Install virtualbox from https://www.virtualbox.org - or follow this tutorial__ |
|
| 20 |
+2. Download the latest boot2docker.iso from https://github.com/boot2docker/boot2docker/releases. |
|
| 21 | 21 |
|
| 22 |
-.. __: http://www.slideshare.net/julienbarbier42/install-virtualbox-on-windows-7 |
|
| 22 |
+3. Start VirtualBox. |
|
| 23 | 23 |
|
| 24 |
-2. Install vagrant from http://www.vagrantup.com - or follow this tutorial__ |
|
| 24 |
+4. Create a new Virtual machine with the following settings: |
|
| 25 | 25 |
|
| 26 |
-.. __: http://www.slideshare.net/julienbarbier42/install-vagrant-on-windows-7 |
|
| 26 |
+ - `Name: boot2docker` |
|
| 27 |
+ - `Type: Linux` |
|
| 28 |
+ - `Version: Linux 2.6 (64 bit)` |
|
| 29 |
+ - `Memory size: 1024 MB` |
|
| 30 |
+ - `Hard drive: Do not add a virtual hard drive` |
|
| 27 | 31 |
|
| 28 |
-3. Install git with ssh from http://git-scm.com/downloads - or follow this tutorial__ |
|
| 32 |
+5. Open the settings of the virtual machine: |
|
| 29 | 33 |
|
| 30 |
-.. __: http://www.slideshare.net/julienbarbier42/install-git-with-ssh-on-windows-7 |
|
| 34 |
+ 5.1. go to Storage |
|
| 31 | 35 |
|
| 36 |
+ 5.2. click the empty slot below `Controller: IDE` |
|
| 32 | 37 |
|
| 33 |
-We recommend having at least 2Gb of free disk space and 2Gb of RAM (or more). |
|
| 38 |
+ 5.3. click the disc icon on the right of `IDE Secondary Master` |
|
| 34 | 39 |
|
| 35 |
-Opening a command prompt |
|
| 40 |
+ 5.4. click `Choose a virtual CD/DVD disk file` |
|
| 36 | 41 |
|
| 37 |
-First open a cmd prompt. Press Windows key and then press “R” |
|
| 38 |
-key. This will open the RUN dialog box for you. Type “cmd” and press |
|
| 39 |
-Enter. Or you can click on Start, type “cmd” in the “Search programs |
|
| 40 |
-and files” field, and click on cmd.exe. |
|
| 42 |
+6. Browse to the path where you've saved the `boot2docker.iso`, select the `boot2docker.iso` and click open. |
|
| 41 | 43 |
|
| 42 |
-.. image:: images/win/_01.gif |
|
| 43 |
- :alt: Git install |
|
| 44 |
- :align: center |
|
| 44 |
+7. Click OK on the Settings dialog to save the changes and close the window. |
|
| 45 | 45 |
|
| 46 |
-This should open a cmd prompt window. |
|
| 46 |
+8. Start the virtual machine by clicking the green start button. |
|
| 47 | 47 |
|
| 48 |
-.. image:: images/win/_02.gif |
|
| 49 |
- :alt: run docker |
|
| 50 |
- :align: center |
|
| 51 |
- |
|
| 52 |
-Alternatively, you can also use a Cygwin terminal, or Git Bash (or any |
|
| 53 |
-other command line program you are usually using). The next steps |
|
| 54 |
-would be the same. |
|
| 55 |
- |
|
| 56 |
-.. _launch_ubuntu: |
|
| 57 |
- |
|
| 58 |
-Launch an Ubuntu virtual server |
|
| 59 |
- |
|
| 60 |
-Let’s download and run an Ubuntu image with docker binaries already |
|
| 61 |
-installed. |
|
| 62 |
- |
|
| 63 |
-.. code-block:: bash |
|
| 64 |
- |
|
| 65 |
- git clone https://github.com/dotcloud/docker.git |
|
| 66 |
- cd docker |
|
| 67 |
- vagrant up |
|
| 68 |
- |
|
| 69 |
-.. image:: images/win/run_02_.gif |
|
| 70 |
- :alt: run docker |
|
| 71 |
- :align: center |
|
| 72 |
- |
|
| 73 |
-Congratulations! You are running an Ubuntu server with docker |
|
| 74 |
-installed on it. You do not see it though, because it is running in |
|
| 75 |
-the background. |
|
| 76 |
- |
|
| 77 |
-Log onto your Ubuntu server |
|
| 78 |
- |
|
| 79 |
-Let’s log into your Ubuntu server now. To do so you have two choices: |
|
| 80 |
- |
|
| 81 |
-- Use Vagrant on Windows command prompt OR |
|
| 82 |
-- Use SSH |
|
| 83 |
- |
|
| 84 |
-Using Vagrant on Windows Command Prompt |
|
| 85 |
-``````````````````````````````````````` |
|
| 86 |
- |
|
| 87 |
-Run the following command |
|
| 88 |
- |
|
| 89 |
-.. code-block:: bash |
|
| 90 |
- |
|
| 91 |
- vagrant ssh |
|
| 92 |
- |
|
| 93 |
-You may see an error message starting with “`ssh` executable not |
|
| 94 |
-found”. In this case it means that you do not have SSH in your |
|
| 95 |
-PATH. If you do not have SSH in your PATH you can set it up with the |
|
| 96 |
-“set” command. For instance, if your ssh.exe is in the folder named |
|
| 97 |
-“C:\Program Files (x86)\Git\bin”, then you can run the following |
|
| 98 |
-command: |
|
| 99 |
- |
|
| 100 |
-.. code-block:: bash |
|
| 101 |
- |
|
| 102 |
- set PATH=%PATH%;C:\Program Files (x86)\Git\bin |
|
| 103 |
- |
|
| 104 |
-.. image:: images/win/run_03.gif |
|
| 105 |
- :alt: run docker |
|
| 106 |
- :align: center |
|
| 107 |
- |
|
| 108 |
-Using SSH |
|
| 109 |
-````````` |
|
| 110 |
- |
|
| 111 |
-First step is to get the IP and port of your Ubuntu server. Simply run: |
|
| 112 |
- |
|
| 113 |
-.. code-block:: bash |
|
| 114 |
- |
|
| 115 |
- vagrant ssh-config |
|
| 116 |
- |
|
| 117 |
-You should see an output with HostName and Port information. In this |
|
| 118 |
-example, HostName is 127.0.0.1 and port is 2222. And the User is |
|
| 119 |
-“vagrant”. The password is not shown, but it is also “vagrant”. |
|
| 120 |
- |
|
| 121 |
-.. image:: images/win/ssh-config.gif |
|
| 122 |
- :alt: run docker |
|
| 123 |
- :align: center |
|
| 124 |
- |
|
| 125 |
-You can now use this information for connecting via SSH to your |
|
| 126 |
-server. To do so you can: |
|
| 127 |
- |
|
| 128 |
-- Use putty.exe OR |
|
| 129 |
-- Use SSH from a terminal |
|
| 130 |
- |
|
| 131 |
-Use putty.exe |
|
| 132 |
-''''''''''''' |
|
| 133 |
- |
|
| 134 |
-You can download putty.exe from this page |
|
| 135 |
-http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html Launch |
|
| 136 |
-putty.exe and simply enter the information you got from last step. |
|
| 137 |
- |
|
| 138 |
-.. image:: images/win/putty.gif |
|
| 139 |
- :alt: run docker |
|
| 140 |
- :align: center |
|
| 141 |
- |
|
| 142 |
-Open, and enter user = vagrant and password = vagrant. |
|
| 143 |
- |
|
| 144 |
-.. image:: images/win/putty_2.gif |
|
| 145 |
- :alt: run docker |
|
| 146 |
- :align: center |
|
| 147 |
- |
|
| 148 |
-SSH from a terminal |
|
| 149 |
-''''''''''''''''''' |
|
| 150 |
- |
|
| 151 |
-You can also run this command on your favorite terminal (windows |
|
| 152 |
-prompt, cygwin, git-bash, …). Make sure to adapt the IP and port from |
|
| 153 |
-what you got from the vagrant ssh-config command. |
|
| 154 |
- |
|
| 155 |
-.. code-block:: bash |
|
| 156 |
- |
|
| 157 |
- ssh vagrant@127.0.0.1 –p 2222 |
|
| 158 |
- |
|
| 159 |
-Enter user = vagrant and password = vagrant. |
|
| 160 |
- |
|
| 161 |
-.. image:: images/win/cygwin.gif |
|
| 162 |
- :alt: run docker |
|
| 163 |
- :align: center |
|
| 164 |
- |
|
| 165 |
-Congratulations, you are now logged onto your Ubuntu Server, running |
|
| 166 |
-on top of your Windows machine ! |
|
| 48 |
+9. The boot2docker virtual machine should boot now. |
|
| 167 | 49 |
|
| 168 | 50 |
Running Docker |
| 169 | 51 |
-------------- |
| 170 | 52 |
|
| 171 |
-First you have to be root in order to run docker. Simply run the |
|
| 172 |
-following command: |
|
| 173 |
- |
|
| 174 |
-.. code-block:: bash |
|
| 53 |
+boot2docker will log you in automatically so you can start using Docker right |
|
| 54 |
+away. |
|
| 175 | 55 |
|
| 176 |
- sudo su |
|
| 177 |
- |
|
| 178 |
-You are now ready for the docker’s “hello world” example. Run |
|
| 56 |
+Let's try the “hello world” example. Run |
|
| 179 | 57 |
|
| 180 | 58 |
.. code-block:: bash |
| 181 | 59 |
|
| 182 | 60 |
docker run busybox echo hello world |
| 183 | 61 |
|
| 184 |
-.. image:: images/win/run_04.gif |
|
| 185 |
- :alt: run docker |
|
| 186 |
- :align: center |
|
| 187 |
- |
|
| 188 |
-All done! |
|
| 189 |
- |
|
| 190 |
-Now you can continue with the :ref:`hello_world` example. |
|
| 62 |
+This will download the small busybox image and print hello world. |
|
| 191 | 63 |
|
| 192 |
-Troubleshooting |
|
| 193 | 64 |
|
| 194 |
-VM does not boot |
|
| 195 |
-```````````````` |
|
| 196 |
- |
|
| 197 |
-.. image:: images/win/ts_go_bios.JPG |
|
| 198 |
- |
|
| 199 |
-If you run into this error message "The VM failed to remain in the |
|
| 200 |
-'running' state while attempting to boot", please check that your |
|
| 201 |
-computer has virtualization technology available and activated by |
|
| 202 |
-going to the BIOS. Here's an example for an HP computer (System |
|
| 203 |
-configuration / Device configuration) |
|
| 204 |
- |
|
| 205 |
-.. image:: images/win/hp_bios_vm.JPG |
|
| 206 |
- |
|
| 207 |
-On some machines the BIOS menu can only be accessed before startup. |
|
| 208 |
-To access BIOS in this scenario you should restart your computer and |
|
| 209 |
-press ESC/Enter when prompted to access the boot and BIOS controls. Typically |
|
| 210 |
-the option to allow virtualization is contained within the BIOS/Security menu. |
|
| 211 |
- |
|
| 212 |
-Docker is not installed |
|
| 213 |
-``````````````````````` |
|
| 65 |
+Observations |
|
| 66 |
+------------ |
|
| 214 | 67 |
|
| 215 |
-.. image:: images/win/ts_no_docker.JPG |
|
| 68 |
+Persistent storage |
|
| 69 |
+`````````````````` |
|
| 216 | 70 |
|
| 217 |
-If you run into this error message "The program 'docker' is currently |
|
| 218 |
-not installed", try deleting the docker folder and restart from |
|
| 219 |
-:ref:`launch_ubuntu` |
|
| 71 |
+The virtual machine created above lacks any persistent data storage. All images |
|
| 72 |
+and containers will be lost when shutting down or rebooting the VM. |