From 62e84785b6ffec04a39cf611d7eaff21f2532195 Mon Sep 17 00:00:00 2001 From: Thijs Terlouw Date: Wed, 21 Aug 2013 15:23:12 +0200 Subject: [PATCH 01/23] proper resolv.conf parsing --- utils/utils.go | 22 +++++++++++++++++++--- utils/utils_test.go | 10 ++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/utils/utils.go b/utils/utils.go index 6a5beb8e4..a8ed1deeb 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -772,21 +772,37 @@ func GetResolvConf() ([]byte, error) { // CheckLocalDns looks into the /etc/resolv.conf, // it returns true if there is a local nameserver or if there is no nameserver. func CheckLocalDns(resolvConf []byte) bool { - if !bytes.Contains(resolvConf, []byte("nameserver")) { + var parsedResolvConf = ParseResolvConf(resolvConf) + if !bytes.Contains(parsedResolvConf, []byte("nameserver")) { return true } - for _, ip := range [][]byte{ []byte("127.0.0.1"), []byte("127.0.1.1"), } { - if bytes.Contains(resolvConf, ip) { + if bytes.Contains(parsedResolvConf, ip) { return true } } return false } +// ParseResolvConf parses the resolv.conf file into lines and strips away comments. +func ParseResolvConf(resolvConf []byte) []byte { + lines := bytes.Split(resolvConf, []byte("\n")) + var noCommentsResolvConf []byte + for _, currentLine := range lines { + var cleanLine = bytes.TrimLeft(currentLine, " \t") + var commentIndex = bytes.Index(cleanLine, []byte("#")) + if ( commentIndex == -1 ) { + noCommentsResolvConf = append(noCommentsResolvConf, cleanLine...) + } else { + noCommentsResolvConf = append(noCommentsResolvConf, cleanLine[:commentIndex]...) + } + } + return noCommentsResolvConf +} + func ParseHost(host string, port int, addr string) string { if strings.HasPrefix(addr, "unix://") { return addr diff --git a/utils/utils_test.go b/utils/utils_test.go index 1030b2902..cdf9c8707 100644 --- a/utils/utils_test.go +++ b/utils/utils_test.go @@ -323,6 +323,16 @@ func TestCheckLocalDns(t *testing.T) { nameserver 10.0.2.3 search dotcloud.net`: false, `# Dynamic +#nameserver 127.0.0.1 +nameserver 10.0.2.3 +search dotcloud.net`: false, + `# Dynamic +nameserver 10.0.2.3 #not used 127.0.1.1 +search dotcloud.net`: false, + `# Dynamic +#nameserver 10.0.2.3 +#search dotcloud.net`: true, + `# Dynamic nameserver 127.0.0.1 search dotcloud.net`: true, `# Dynamic From c349b4d56c338bc43c81667bb927518b923998cb Mon Sep 17 00:00:00 2001 From: Thijs Terlouw Date: Wed, 21 Aug 2013 15:48:39 +0200 Subject: [PATCH 02/23] Keep linebreaks and generalize code --- utils/utils.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/utils/utils.go b/utils/utils.go index a8ed1deeb..1fd4c77a7 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -772,7 +772,7 @@ func GetResolvConf() ([]byte, error) { // CheckLocalDns looks into the /etc/resolv.conf, // it returns true if there is a local nameserver or if there is no nameserver. func CheckLocalDns(resolvConf []byte) bool { - var parsedResolvConf = ParseResolvConf(resolvConf) + var parsedResolvConf = StripComments(resolvConf, []byte("#")) if !bytes.Contains(parsedResolvConf, []byte("nameserver")) { return true } @@ -787,20 +787,20 @@ func CheckLocalDns(resolvConf []byte) bool { return false } -// ParseResolvConf parses the resolv.conf file into lines and strips away comments. -func ParseResolvConf(resolvConf []byte) []byte { - lines := bytes.Split(resolvConf, []byte("\n")) - var noCommentsResolvConf []byte +// StripComments parses input into lines and strips away comments. +func StripComments(input []byte, commentMarker []byte) []byte { + lines := bytes.Split(input, []byte("\n")) + var output []byte for _, currentLine := range lines { - var cleanLine = bytes.TrimLeft(currentLine, " \t") - var commentIndex = bytes.Index(cleanLine, []byte("#")) + var commentIndex = bytes.Index(currentLine, commentMarker) if ( commentIndex == -1 ) { - noCommentsResolvConf = append(noCommentsResolvConf, cleanLine...) + output = append(output, currentLine...) } else { - noCommentsResolvConf = append(noCommentsResolvConf, cleanLine[:commentIndex]...) + output = append(output, currentLine[:commentIndex]...) } + output = append(output, []byte("\n")...) } - return noCommentsResolvConf + return output } func ParseHost(host string, port int, addr string) string { From f83d556bc0dec17af72bf3644fefdf0f232e206f Mon Sep 17 00:00:00 2001 From: Solomon Hykes Date: Sat, 24 Aug 2013 17:16:52 -0700 Subject: [PATCH 03/23] Make Kawsar Saiyeed @KSid the maintainer for contributed tools --- contrib/MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/MAINTAINERS b/contrib/MAINTAINERS index 0b7931f90..2531745dc 100644 --- a/contrib/MAINTAINERS +++ b/contrib/MAINTAINERS @@ -1 +1 @@ -# Maintainer wanted! Enroll on #docker@freenode +Kawsar Saiyeed From 331f983593a527f04046c2d6131847adcdf95e3e Mon Sep 17 00:00:00 2001 From: Greg Thornton Date: Mon, 26 Aug 2013 09:43:49 -0500 Subject: [PATCH 04/23] Start docker after lxc-net to prevent ip forwarding race --- packaging/ubuntu/docker.upstart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/ubuntu/docker.upstart b/packaging/ubuntu/docker.upstart index 143be0340..2370cb555 100644 --- a/packaging/ubuntu/docker.upstart +++ b/packaging/ubuntu/docker.upstart @@ -1,6 +1,6 @@ description "Run docker" -start on filesystem or runlevel [2345] +start on filesystem and started lxc-net stop on runlevel [!2345] respawn From d80b50d4b4759665b93e713b99239aba9893416e Mon Sep 17 00:00:00 2001 From: jbbarth Date: Mon, 26 Aug 2013 17:45:52 +0200 Subject: [PATCH 05/23] Improve formatting with 'go fmt' as stated in CONTRIBUTING.md As 'go fmt' doesn't support verifying files in multiple directories, it's probably a good idea to run it on all '*.go' files from time to time with something like this: find . -name "*.go" | xargs dirname | sort -u | xargs -n 1 echo go fmt --- commands.go | 2 +- commands_test.go | 1 - docker/docker.go | 2 +- sysinit.go | 3 +-- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/commands.go b/commands.go index 236fb65d1..41e20158b 100644 --- a/commands.go +++ b/commands.go @@ -30,7 +30,7 @@ import ( var ( GITCOMMIT string - VERSION string + VERSION string ) func (cli *DockerCli) getMethod(name string) (reflect.Method, bool) { diff --git a/commands_test.go b/commands_test.go index 25e480436..2946da879 100644 --- a/commands_test.go +++ b/commands_test.go @@ -152,7 +152,6 @@ func TestRunWorkdirExists(t *testing.T) { } - func TestRunExit(t *testing.T) { stdin, stdinPipe := io.Pipe() stdout, stdoutPipe := io.Pipe() diff --git a/docker/docker.go b/docker/docker.go index 6ac0c9379..9bbd40b69 100644 --- a/docker/docker.go +++ b/docker/docker.go @@ -16,7 +16,7 @@ import ( var ( GITCOMMIT string - VERSION string + VERSION string ) func main() { diff --git a/sysinit.go b/sysinit.go index aa5d2b2a1..34f1cbdac 100644 --- a/sysinit.go +++ b/sysinit.go @@ -27,10 +27,9 @@ func setupWorkingDirectory(workdir string) { if workdir == "" { return } - syscall.Chdir(workdir) + syscall.Chdir(workdir) } - // Takes care of dropping privileges to the desired user func changeUser(u string) { if u == "" { From 466a88b9a8331154730551c0009b67cded83ba58 Mon Sep 17 00:00:00 2001 From: Thatcher Peskens Date: Tue, 27 Aug 2013 19:59:36 -0700 Subject: [PATCH 06/23] added apt-key finger tip and fingerprint in ubuntu installation page --- docs/sources/installation/ubuntulinux.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/sources/installation/ubuntulinux.rst b/docs/sources/installation/ubuntulinux.rst index 4142a9c37..cb7919270 100644 --- a/docs/sources/installation/ubuntulinux.rst +++ b/docs/sources/installation/ubuntulinux.rst @@ -67,6 +67,7 @@ to follow them again.* .. code-block:: bash # Add the Docker repository key to your local keychain + # using apt-key finger you can check the fingerprint matches 36A1 D786 9245 C895 0F96 6E92 D857 6A8B A88D 21E9 sudo sh -c "curl https://get.docker.io/gpg | apt-key add -" # Add the Docker repository to your apt sources list. @@ -120,6 +121,7 @@ to follow them again.* .. code-block:: bash # Add the Docker repository key to your local keychain + # using apt-key finger you can check the fingerprint matches 36A1 D786 9245 C895 0F96 6E92 D857 6A8B A88D 21E9 sudo sh -c "curl http://get.docker.io/gpg | apt-key add -" # Add the Docker repository to your apt sources list. From 20772f90fff54f95fc8cafe2b0c9be4c093cbf64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Fr=C3=B6ssman?= Date: Wed, 28 Aug 2013 18:02:14 +0200 Subject: [PATCH 07/23] Fix bash completion, remove have Should solve #1639. --- contrib/docker.bash | 2 -- 1 file changed, 2 deletions(-) diff --git a/contrib/docker.bash b/contrib/docker.bash index 32f2b5f8f..63df98825 100644 --- a/contrib/docker.bash +++ b/contrib/docker.bash @@ -21,7 +21,6 @@ # If the docker daemon is using a unix socket for communication your user # must have access to the socket for the completions to function correctly -have docker && { __docker_containers_all() { local containers @@ -542,4 +541,3 @@ _docker() } complete -F _docker docker -} \ No newline at end of file From b1eae313ad7d28142c7e0a8a60e3961bed0c84f0 Mon Sep 17 00:00:00 2001 From: Andy Rothfusz Date: Wed, 28 Aug 2013 17:26:10 -0700 Subject: [PATCH 08/23] Fix #1685: Notes on production use. General installation cleanup. --- docs/sources/installation/amazon.rst | 18 +++-- docs/sources/installation/archlinux.rst | 8 +- docs/sources/installation/binaries.rst | 15 ++-- docs/sources/installation/install_header.inc | 7 ++ .../installation/install_unofficial.inc | 7 ++ docs/sources/installation/rackspace.rst | 31 ++++---- docs/sources/installation/ubuntulinux.rst | 42 +++++++---- docs/sources/installation/upgrading.rst | 32 ++++++-- docs/sources/installation/vagrant.rst | 27 ++++--- docs/sources/installation/windows.rst | 73 ++++++++++++------- docs/sources/use/basics.rst | 2 + 11 files changed, 167 insertions(+), 95 deletions(-) create mode 100644 docs/sources/installation/install_header.inc create mode 100644 docs/sources/installation/install_unofficial.inc diff --git a/docs/sources/installation/amazon.rst b/docs/sources/installation/amazon.rst index 333374f97..b9344042f 100644 --- a/docs/sources/installation/amazon.rst +++ b/docs/sources/installation/amazon.rst @@ -5,18 +5,20 @@ Using Vagrant (Amazon EC2) ========================== -This page explains how to setup and run an Amazon EC2 instance from your local machine. -Vagrant is not necessary to run Docker on EC2. You can follow the :ref:`ubuntu_linux` instructions -installing Docker on any EC2 instance running Ubuntu +This page explains how to setup and run an Amazon EC2 instance from +your local machine. **Vagrant is not necessary to run Docker on +EC2.** You can follow the :ref:`ubuntu_linux` instructions installing +Docker on any EC2 instance running Ubuntu. - Please note this is a community contributed installation path. The only 'official' installation is using the - :ref:`ubuntu_linux` installation path. This version may sometimes be out of date. - - Installation ------------ -Docker can now be installed on Amazon EC2 with a single vagrant command. Vagrant 1.1 or higher is required. +.. include:: install_header.inc + +.. include:: install_unofficial.inc + +Docker can now be installed on Amazon EC2 with a single vagrant +command. Vagrant 1.1 or higher is required. 1. Install vagrant from http://www.vagrantup.com/ (or use your package manager) 2. Install the vagrant aws plugin diff --git a/docs/sources/installation/archlinux.rst b/docs/sources/installation/archlinux.rst index 722c15019..4f0f21174 100644 --- a/docs/sources/installation/archlinux.rst +++ b/docs/sources/installation/archlinux.rst @@ -7,10 +7,6 @@ Arch Linux ========== - Please note this is a community contributed installation path. The only 'official' installation is using the - :ref:`ubuntu_linux` installation path. This version may sometimes be out of date. - - Installing on Arch Linux is not officially supported but can be handled via either of the following AUR packages: @@ -36,6 +32,10 @@ either AUR package. Installation ------------ +.. include:: install_header.inc + +.. include:: install_unofficial.inc + The instructions here assume **yaourt** is installed. See `Arch User Repository `_ for information on building and installing packages from the AUR if you have not diff --git a/docs/sources/installation/binaries.rst b/docs/sources/installation/binaries.rst index 24de52814..fea48bd7a 100644 --- a/docs/sources/installation/binaries.rst +++ b/docs/sources/installation/binaries.rst @@ -7,9 +7,10 @@ Binaries ======== - **Please note this project is currently under heavy development. It should not be used in production.** +.. include:: install_header.inc -**This instruction set is meant for hackers who want to try out Docker on a variety of environments.** +**This instruction set is meant for hackers who want to try out Docker +on a variety of environments.** Right now, the officially supported distributions are: @@ -23,14 +24,10 @@ But we know people have had success running it under - Suse - :ref:`arch_linux` +Check Your Kernel +----------------- -Dependencies: -------------- - -* 3.8 Kernel (read more about :ref:`kernel`) -* AUFS filesystem support -* lxc -* xz-utils +Your host's Linux kernel must meet the Docker :ref:`kernel` Get the docker binary: ---------------------- diff --git a/docs/sources/installation/install_header.inc b/docs/sources/installation/install_header.inc new file mode 100644 index 000000000..c9b9e4c49 --- /dev/null +++ b/docs/sources/installation/install_header.inc @@ -0,0 +1,7 @@ + +.. note:: + + 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" + `_ diff --git a/docs/sources/installation/install_unofficial.inc b/docs/sources/installation/install_unofficial.inc new file mode 100644 index 000000000..8d121918b --- /dev/null +++ b/docs/sources/installation/install_unofficial.inc @@ -0,0 +1,7 @@ + +.. note:: + + This is a community contributed installation path. The only + 'official' installation is using the :ref:`ubuntu_linux` + installation path. This version may be out of date because it + depends on some binaries to be updated and published diff --git a/docs/sources/installation/rackspace.rst b/docs/sources/installation/rackspace.rst index 7f360682e..2a4bdbc95 100644 --- a/docs/sources/installation/rackspace.rst +++ b/docs/sources/installation/rackspace.rst @@ -6,21 +6,22 @@ Rackspace Cloud =============== - Please note this is a community contributed installation path. The only 'official' installation is using the - :ref:`ubuntu_linux` installation path. This version may sometimes be out of date. +.. include:: install_unofficial.inc - -Installing Docker on Ubuntu provided by Rackspace is pretty straightforward, and you should mostly be able to follow the +Installing Docker on Ubuntu provided by Rackspace is pretty +straightforward, and you should mostly be able to follow the :ref:`ubuntu_linux` installation guide. **However, there is one caveat:** -If you are using any linux not already shipping with the 3.8 kernel you will need to install it. And this is a little -more difficult on Rackspace. +If you are using any linux not already shipping with the 3.8 kernel +you will need to install it. And this is a little more difficult on +Rackspace. -Rackspace boots their servers using grub's menu.lst and does not like non 'virtual' packages (e.g. xen compatible) -kernels there, although they do work. This makes ``update-grub`` to not have the expected result, and you need to -set the kernel manually. +Rackspace boots their servers using grub's ``menu.lst`` and does not +like non 'virtual' packages (e.g. xen compatible) kernels there, +although they do work. This makes ``update-grub`` to not have the +expected result, and you need to set the kernel manually. **Do not attempt this on a production machine!** @@ -33,7 +34,8 @@ set the kernel manually. apt-get install linux-generic-lts-raring -Great, now you have kernel installed in /boot/, next is to make it boot next time. +Great, now you have kernel installed in ``/boot/``, next is to make it +boot next time. .. code-block:: bash @@ -43,9 +45,10 @@ Great, now you have kernel installed in /boot/, next is to make it boot next tim # this should return some results -Now you need to manually edit /boot/grub/menu.lst, you will find a section at the bottom with the existing options. -Copy the top one and substitute the new kernel into that. Make sure the new kernel is on top, and double check kernel -and initrd point to the right files. +Now you need to manually edit ``/boot/grub/menu.lst``, you will find a +section at the bottom with the existing options. Copy the top one and +substitute the new kernel into that. Make sure the new kernel is on +top, and double check kernel and initrd point to the right files. Make special care to double check the kernel and initrd entries. @@ -92,4 +95,4 @@ Verify the kernel was updated # nice! 3.8. -Now you can finish with the :ref:`ubuntu_linux` instructions. \ No newline at end of file +Now you can finish with the :ref:`ubuntu_linux` instructions. diff --git a/docs/sources/installation/ubuntulinux.rst b/docs/sources/installation/ubuntulinux.rst index 4142a9c37..dec2eb59c 100644 --- a/docs/sources/installation/ubuntulinux.rst +++ b/docs/sources/installation/ubuntulinux.rst @@ -2,15 +2,17 @@ :description: Please note this project is currently under heavy development. It should not be used in production. :keywords: Docker, Docker documentation, requirements, virtualbox, vagrant, git, ssh, putty, cygwin, linux -**These instructions have changed for 0.6. If you are upgrading from an earlier version, you will need to follow them again.** - .. _ubuntu_linux: Ubuntu Linux ============ - **Please note this project is currently under heavy development. It should not be used in production.** +.. warning:: + These instructions have changed for 0.6. If you are upgrading from + an earlier version, you will need to follow them again. + +.. include:: install_header.inc Right now, the officially supported distribution are: @@ -22,7 +24,8 @@ Docker has the following dependencies * Linux kernel 3.8 (read more about :ref:`kernel`) * AUFS file system support (we are working on BTRFS support as an alternative) -Please read :ref:`ufw`, if you plan to use `UFW (Uncomplicated Firewall) `_ +Please read :ref:`ufw`, if you plan to use `UFW (Uncomplicated +Firewall) `_ .. _ubuntu_precise: @@ -38,12 +41,13 @@ Dependencies **Linux kernel 3.8** Due to a bug in LXC, docker works best on the 3.8 kernel. Precise -comes with a 3.2 kernel, so we need to upgrade it. The kernel you'll install when following these steps -comes with AUFS built in. We also include the generic headers -to enable packages that depend on them, like ZFS and the VirtualBox -guest additions. If you didn't install the headers for your "precise" -kernel, then you can skip these headers for the "raring" kernel. But -it is safer to include them if you're not sure. +comes with a 3.2 kernel, so we need to upgrade it. The kernel you'll +install when following these steps comes with AUFS built in. We also +include the generic headers to enable packages that depend on them, +like ZFS and the VirtualBox guest additions. If you didn't install the +headers for your "precise" kernel, then you can skip these headers for +the "raring" kernel. But it is safer to include them if you're not +sure. .. code-block:: bash @@ -59,10 +63,13 @@ it is safer to include them if you're not sure. Installation ------------ +.. warning:: + + These instructions have changed for 0.6. If you are upgrading from + an earlier version, you will need to follow them again. + Docker is available as a Debian package, which makes installation easy. -*Please note that these instructions have changed for 0.6. If you are upgrading from an earlier version, you will need -to follow them again.* .. code-block:: bash @@ -136,7 +143,8 @@ Verify it worked .. code-block:: bash - # download the base 'ubuntu' container and run bash inside it while setting up an interactive shell + # download the base 'ubuntu' container + # and run bash inside it while setting up an interactive shell sudo docker run -i -t ubuntu /bin/bash # type exit to exit @@ -150,7 +158,8 @@ Verify it worked Docker and UFW ^^^^^^^^^^^^^^ -Docker uses a bridge to manage containers networking, by default UFW drop all `forwarding`, a first step is to enable forwarding: +Docker uses a bridge to manage containers networking, by default UFW +drop all `forwarding`, a first step is to enable forwarding: .. code-block:: bash @@ -168,8 +177,9 @@ Then reload UFW: sudo ufw reload -UFW's default set of rules denied all `incoming`, so if you want to be able to reach your containers from another host, -you should allow incoming connections on the docker port (default 4243): +UFW's default set of rules denied all `incoming`, so if you want to be +able to reach your containers from another host, you should allow +incoming connections on the docker port (default 4243): .. code-block:: bash diff --git a/docs/sources/installation/upgrading.rst b/docs/sources/installation/upgrading.rst index 9fa47904b..47482314f 100644 --- a/docs/sources/installation/upgrading.rst +++ b/docs/sources/installation/upgrading.rst @@ -5,18 +5,32 @@ .. _upgrading: Upgrading -============ +========= -**These instructions are for upgrading Docker** +The technique for upgrading ``docker`` to a newer version depends on +how you installed ``docker``. + +.. versionadded:: 0.5.3 + You may wish to add a ``docker`` group to your system to avoid using sudo with ``docker``. (see :ref:`dockergroup`) -After normal installation -------------------------- +After ``apt-get`` +----------------- -If you installed Docker normally using apt-get or used Vagrant, use apt-get to upgrade. +If you installed Docker using ``apt-get`` or Vagrant, then you should +use ``apt-get`` to upgrade. + +.. versionadded:: 0.6 + Add Docker repository information to your system first. .. code-block:: bash + # Add the Docker repository key to your local keychain + sudo sh -c "curl https://get.docker.io/gpg | apt-key add -" + + # Add the Docker repository to your apt sources list. + sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list" + # update your sources list sudo apt-get update @@ -27,7 +41,7 @@ If you installed Docker normally using apt-get or used Vagrant, use apt-get to u After manual installation ------------------------- -If you installed the Docker binary +If you installed the Docker :ref:`binaries` then follow these steps: .. code-block:: bash @@ -48,8 +62,10 @@ If you installed the Docker binary tar -xf docker-latest.tgz -Start docker in daemon mode (-d) and disconnect (&) starting ./docker will start the version in your current dir rather than a version which -might reside in your path. +Start docker in daemon mode (``-d``) and disconnect, running the +daemon in the background (``&``). Starting as ``./docker`` guarantees +to run the version in your current directory rather than a version +which might reside in your path. .. code-block:: bash diff --git a/docs/sources/installation/vagrant.rst b/docs/sources/installation/vagrant.rst index 568ec584e..14f5bf5cd 100644 --- a/docs/sources/installation/vagrant.rst +++ b/docs/sources/installation/vagrant.rst @@ -2,31 +2,36 @@ :description: This guide will setup a new virtualbox virtual machine with docker installed on your computer. :keywords: Docker, Docker documentation, virtualbox, vagrant, git, ssh, putty, cygwin -**Vagrant installation is temporarily out of date, it will be updated for 0.6 soon.** - .. _install_using_vagrant: Using Vagrant (Mac, Linux) ========================== -This guide will setup a new virtualbox virtual machine with docker installed on your computer. This works on most operating -systems, including MacOX, Windows, Linux, FreeBSD and others. If you can install these and have at least 400Mb RAM -to spare you should be good. - +This guide will setup a new virtualbox virtual machine with docker +installed on your computer. This works on most operating systems, +including MacOX, Windows, Linux, FreeBSD and others. If you can +install these and have at least 400Mb RAM to spare you should be good. Install Vagrant and Virtualbox ------------------------------ -1. Install virtualbox from https://www.virtualbox.org/ (or use your package manager) -2. Install vagrant from http://www.vagrantup.com/ (or use your package manager) -3. Install git if you had not installed it before, check if it is installed by running - ``git`` in a terminal window +.. include:: install_header.inc + +.. include:: install_unofficial.inc + +#. Install virtualbox from https://www.virtualbox.org/ (or use your + package manager) +#. Install vagrant from http://www.vagrantup.com/ (or use your package + manager) +#. Install git if you had not installed it before, check if it is + installed by running ``git`` in a terminal window Spin it up ---------- -1. Fetch the docker sources (this includes the Vagrantfile for machine setup). +1. Fetch the docker sources (this includes the ``Vagrantfile`` for + machine setup). .. code-block:: bash diff --git a/docs/sources/installation/windows.rst b/docs/sources/installation/windows.rst index 889db4c67..a6b30aa41 100644 --- a/docs/sources/installation/windows.rst +++ b/docs/sources/installation/windows.rst @@ -2,21 +2,21 @@ :description: Docker's tutorial to run docker on Windows :keywords: Docker, Docker documentation, Windows, requirements, virtualbox, vagrant, git, ssh, putty, cygwin -**Vagrant installation is temporarily out of date, it will be updated for 0.6 soon.** - .. _windows: Using Vagrant (Windows) ======================= - Please note this is a community contributed installation path. The only 'official' installation is using the :ref:`ubuntu_linux` installation path. This version - may be out of date because it depends on some binaries to be updated and published +Docker can run on Windows using a VM like VirtualBox. You then run +Linux within the VM. - - -Requirements +Installation ------------ +.. include:: install_header.inc + +.. include:: install_unofficial.inc + 1. Install virtualbox from https://www.virtualbox.org - or follow this tutorial__ .. __: http://www.slideshare.net/julienbarbier42/install-virtualbox-on-windows-7 @@ -35,7 +35,10 @@ We recommend having at least 2Gb of free disk space and 2Gb of RAM (or more). Opening a command prompt ------------------------ -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. +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. .. image:: images/win/_01.gif :alt: Git install @@ -47,14 +50,17 @@ This should open a cmd prompt window. :alt: run docker :align: center -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. +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. .. _launch_ubuntu: Launch an Ubuntu virtual server ------------------------------- -Let’s download and run an Ubuntu image with docker binaries already installed. +Let’s download and run an Ubuntu image with docker binaries already +installed. .. code-block:: bash @@ -66,7 +72,9 @@ Let’s download and run an Ubuntu image with docker binaries already installed. :alt: run docker :align: center -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. +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. Log onto your Ubuntu server --------------------------- @@ -85,7 +93,12 @@ 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)\Git\bin”, then you can run the following command: +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)\Git\bin”, then you can run the following +command: .. code-block:: bash @@ -104,13 +117,16 @@ 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 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”. .. image:: images/win/ssh-config.gif :alt: run docker :align: center -You can now use this information for connecting via SSH to your server. To do so you can: +You can now use this information for connecting via SSH to your +server. To do so you can: - Use putty.exe OR - Use SSH from a terminal @@ -118,8 +134,9 @@ You can now use this information for connecting via SSH to your server. To do so Use putty.exe ''''''''''''' -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. +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. .. image:: images/win/putty.gif :alt: run docker @@ -134,7 +151,9 @@ Open, and enter user = vagrant and password = vagrant. SSH from a terminal ''''''''''''''''''' -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. +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. .. code-block:: bash @@ -146,12 +165,14 @@ Enter user = vagrant and password = vagrant. :alt: run docker :align: center -Congratulations, you are now logged onto your Ubuntu Server, running on top of your Windows machine ! +Congratulations, you are now logged onto your Ubuntu Server, running +on top of your Windows machine ! Running Docker -------------- -First you have to be root in order to run docker. Simply run the following command: +First you have to be root in order to run docker. Simply run the +following command: .. code-block:: bash @@ -179,10 +200,11 @@ VM does not boot .. image:: images/win/ts_go_bios.JPG -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) +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) .. image:: images/win/hp_bios_vm.JPG @@ -192,5 +214,6 @@ Docker is not installed .. image:: images/win/ts_no_docker.JPG -If you run into this error message "The program 'docker' is currently not installed", -try deleting the docker folder and restart from :ref:`launch_ubuntu` +If you run into this error message "The program 'docker' is currently +not installed", try deleting the docker folder and restart from +:ref:`launch_ubuntu` diff --git a/docs/sources/use/basics.rst b/docs/sources/use/basics.rst index acae031f0..d37bf40b0 100644 --- a/docs/sources/use/basics.rst +++ b/docs/sources/use/basics.rst @@ -37,6 +37,8 @@ Running an interactive shell # use the escape sequence Ctrl-p + Ctrl-q sudo docker run -i -t ubuntu /bin/bash +.. _dockergroup: + Why ``sudo``? ------------- From 37a236947eaa611a441328a0dfc015091402292b Mon Sep 17 00:00:00 2001 From: Andrew Munsell Date: Wed, 28 Aug 2013 22:18:47 -0700 Subject: [PATCH 09/23] Add privileged flag in documentation for container creation --- docs/sources/api/docker_remote_api_v1.4.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/sources/api/docker_remote_api_v1.4.rst b/docs/sources/api/docker_remote_api_v1.4.rst index 0adb5b834..85012e9af 100644 --- a/docs/sources/api/docker_remote_api_v1.4.rst +++ b/docs/sources/api/docker_remote_api_v1.4.rst @@ -119,6 +119,7 @@ Create a container "AttachStdout":true, "AttachStderr":true, "PortSpecs":null, + "Privileged": false, "Tty":false, "OpenStdin":false, "StdinOnce":false, From 57892365ef325d824ba6ce45a8e24e48cd117f0c Mon Sep 17 00:00:00 2001 From: dsissitka Date: Thu, 29 Aug 2013 12:35:37 -0400 Subject: [PATCH 10/23] Fixed a minor syntax error. --- docs/sources/api/docker_remote_api_v1.4.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/api/docker_remote_api_v1.4.rst b/docs/sources/api/docker_remote_api_v1.4.rst index 0adb5b834..59536bfaf 100644 --- a/docs/sources/api/docker_remote_api_v1.4.rst +++ b/docs/sources/api/docker_remote_api_v1.4.rst @@ -1082,7 +1082,7 @@ Create a new image from a container's changes POST /commit?container=44c004db4b17&m=message&repo=myrepo HTTP/1.1 - **Example response**: + **Example response**: .. sourcecode:: http From 3f141e1fd3a11507b049359ea59253b49395d494 Mon Sep 17 00:00:00 2001 From: Greg Thornton Date: Thu, 29 Aug 2013 14:06:24 -0500 Subject: [PATCH 11/23] Update remaining upstart scripts to wait for lxc-net --- contrib/install.sh | 2 +- hack/release/make.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/install.sh b/contrib/install.sh index 3cf7169a0..40e3aaafb 100755 --- a/contrib/install.sh +++ b/contrib/install.sh @@ -47,7 +47,7 @@ else echo "Creating /etc/init/dockerd.conf..." cat >/etc/init/dockerd.conf < Date: Thu, 29 Aug 2013 23:49:41 +0000 Subject: [PATCH 17/23] added a Dockerfile which installs all deps and builds the docs. --- docs/Dockerfile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 docs/Dockerfile diff --git a/docs/Dockerfile b/docs/Dockerfile new file mode 100644 index 000000000..e5fd267eb --- /dev/null +++ b/docs/Dockerfile @@ -0,0 +1,15 @@ +from ubuntu:12.04 +maintainer Nick Stinemates + +run apt-get update +run apt-get install -y python-setuptools make +run easy_install pip +add . /docs +run pip install -r /docs/requirements.txt +run cd /docs; make docs + +expose 8000 + +workdir /docs/_build/html + +entrypoint ["python", "-m", "SimpleHTTPServer"] From e3b58d302795fbbfa6c117774906a4c9efd536f4 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Fri, 30 Aug 2013 00:46:43 +0000 Subject: [PATCH 18/23] hide version when not available --- commands.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/commands.go b/commands.go index 41e20158b..01256b1da 100644 --- a/commands.go +++ b/commands.go @@ -434,8 +434,9 @@ func (cli *DockerCli) CmdVersion(args ...string) error { cmd.Usage() return nil } - - fmt.Fprintf(cli.out, "Client version: %s\n", VERSION) + if VERSION != "" { + fmt.Fprintf(cli.out, "Client version: %s\n", VERSION) + } fmt.Fprintf(cli.out, "Go version (client): %s\n", runtime.Version()) if GITCOMMIT != "" { fmt.Fprintf(cli.out, "Git commit (client): %s\n", GITCOMMIT) @@ -452,7 +453,9 @@ func (cli *DockerCli) CmdVersion(args ...string) error { utils.Debugf("Error unmarshal: body: %s, err: %s\n", body, err) return err } - fmt.Fprintf(cli.out, "Server version: %s\n", out.Version) + if out.Version != "" { + fmt.Fprintf(cli.out, "Server version: %s\n", out.Version) + } if out.GitCommit != "" { fmt.Fprintf(cli.out, "Git commit (server): %s\n", out.GitCommit) } @@ -463,7 +466,7 @@ func (cli *DockerCli) CmdVersion(args ...string) error { release := utils.GetReleaseVersion() if release != "" { fmt.Fprintf(cli.out, "Last stable version: %s", release) - if strings.Trim(VERSION, "-dev") != release || strings.Trim(out.Version, "-dev") != release { + if (VERSION != "" || out.Version != "") && (strings.Trim(VERSION, "-dev") != release || strings.Trim(out.Version, "-dev") != release) { fmt.Fprintf(cli.out, ", please update docker") } fmt.Fprintf(cli.out, "\n") From c0e95fa68a37166ce551a33332bbede6b6531b68 Mon Sep 17 00:00:00 2001 From: dsissitka Date: Thu, 29 Aug 2013 21:05:18 -0400 Subject: [PATCH 19/23] Updated "Use -> The Basics" to use ubuntu:12.10. ubuntu:latest doesn't have nc. ubuntu:12.10 does. --- docs/sources/use/basics.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/use/basics.rst b/docs/sources/use/basics.rst index d37bf40b0..8b4676f6e 100644 --- a/docs/sources/use/basics.rst +++ b/docs/sources/use/basics.rst @@ -142,7 +142,7 @@ Expose a service on a TCP port .. code-block:: bash # Expose port 4444 of this container, and tell netcat to listen on it - JOB=$(sudo docker run -d -p 4444 ubuntu /bin/nc -l -p 4444) + JOB=$(sudo docker run -d -p 4444 ubuntu:12.10 /bin/nc -l -p 4444) # Which public port is NATed to my container? PORT=$(sudo docker port $JOB 4444) From 6c206f7d7835310c39ef20d3375e949b1fbfd7b9 Mon Sep 17 00:00:00 2001 From: "Shih-Yuan Lee (FourDollars)" Date: Wed, 21 Aug 2013 12:44:58 +0800 Subject: [PATCH 20/23] Install Ubuntu raring backported kernel from official archives directly. --- Vagrantfile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 4cee3a04d..53620eabc 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -20,15 +20,13 @@ Vagrant::Config.run do |config| pkg_cmd = "wget -q -O - http://get.docker.io/gpg | apt-key add -;" \ "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list;" \ "apt-get update -qq; apt-get install -q -y --force-yes lxc-docker; " - # Add X.org Ubuntu backported 3.8 kernel - pkg_cmd << "apt-get update -qq; apt-get install -q -y python-software-properties; " \ - "add-apt-repository -y ppa:ubuntu-x-swat/r-lts-backport; " \ - "apt-get update -qq; apt-get install -q -y linux-image-3.8.0-19-generic; " + # Add Ubuntu raring backported kernel + pkg_cmd << "apt-get update -qq; apt-get install -q -y linux-image-generic-lts-raring; " # Add guest additions if local vbox VM is_vbox = true ARGV.each do |arg| is_vbox &&= !arg.downcase.start_with?("--provider") end if is_vbox - pkg_cmd << "apt-get install -q -y linux-headers-3.8.0-19-generic dkms; " \ + pkg_cmd << "apt-get install -q -y linux-headers-generic-lts-raring dkms; " \ "echo 'Downloading VBox Guest Additions...'; " \ "wget -q http://dlc.sun.com.edgesuite.net/virtualbox/4.2.12/VBoxGuestAdditions_4.2.12.iso; " # Prepare the VM to add guest additions after reboot From 1a8a540209c997f5e75a476b942365aad892ad35 Mon Sep 17 00:00:00 2001 From: Morten Siebuhr Date: Fri, 30 Aug 2013 15:23:32 +0200 Subject: [PATCH 21/23] Document FROM : Dockerfile instruction. --- docs/sources/use/builder.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/sources/use/builder.rst b/docs/sources/use/builder.rst index 7a985e766..61c7fccd1 100644 --- a/docs/sources/use/builder.rst +++ b/docs/sources/use/builder.rst @@ -68,6 +68,10 @@ building images. ``FROM `` +Or + + ``FROM :`` + The ``FROM`` instruction sets the :ref:`base_image_def` for subsequent instructions. As such, a valid Dockerfile must have ``FROM`` as its first instruction. The image can be any valid image -- it is @@ -81,6 +85,9 @@ especially easy to start by **pulling an image** from the to create multiple images. Simply make a note of the last image id output by the commit before each new ``FROM`` command. +If no ``tag`` is given to the ``FROM`` instruction, ``latest`` is +assumed. If the used tag does not exist, an error will be returned. + 3.2 MAINTAINER -------------- From d605e82badf64c3033f5f26199285aed414f63dd Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Fri, 30 Aug 2013 18:08:29 +0000 Subject: [PATCH 22/23] fix error in docker build when param is not a directory --- commands.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/commands.go b/commands.go index 6d78c032f..0b276ff77 100644 --- a/commands.go +++ b/commands.go @@ -187,8 +187,10 @@ func (cli *DockerCli) CmdBuild(args ...string) error { } else if utils.IsURL(cmd.Arg(0)) || utils.IsGIT(cmd.Arg(0)) { isRemote = true } else { - if _, err := os.Stat(cmd.Arg(0)); err != nil { + if fi, err := os.Stat(cmd.Arg(0)); err != nil { return err + } else if !fi.IsDir() { + return fmt.Errorf("\"%s\" is not a path or URL. Please provide a path to a directory containing a Dockerfile.", cmd.Arg(0)) } context, err = Tar(cmd.Arg(0), Uncompressed) } From 46c9c5c84317907153f06284dc5110b53a0fbf3c Mon Sep 17 00:00:00 2001 From: Brian Olsen Date: Fri, 30 Aug 2013 21:45:01 +0200 Subject: [PATCH 23/23] Made calling changelog before run return empty. Fixes #1705. --- changes.go | 2 +- container_test.go | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/changes.go b/changes.go index dc1b01572..43573cd60 100644 --- a/changes.go +++ b/changes.go @@ -99,7 +99,7 @@ func Changes(layers []string, rw string) ([]Change, error) { changes = append(changes, change) return nil }) - if err != nil { + if err != nil && !os.IsNotExist(err) { return nil, err } return changes, nil diff --git a/container_test.go b/container_test.go index ba48ceb47..b06d531cf 100644 --- a/container_test.go +++ b/container_test.go @@ -138,12 +138,21 @@ func TestDiff(t *testing.T) { container1, _, _ := mkContainer(runtime, []string{"_", "/bin/rm", "/etc/passwd"}, t) defer runtime.Destroy(container1) + // The changelog should be empty and not fail before run. See #1705 + c, err := container1.Changes() + if err != nil { + t.Fatal(err) + } + if len(c) != 0 { + t.Fatalf("Changelog should be empty before run") + } + if err := container1.Run(); err != nil { t.Fatal(err) } // Check the changelog - c, err := container1.Changes() + c, err = container1.Changes() if err != nil { t.Fatal(err) }