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 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/commands.go b/commands.go index be2a4c02d..95f67f4f3 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) { @@ -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) } @@ -390,8 +392,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) @@ -408,7 +411,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) } @@ -419,7 +424,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") @@ -1379,7 +1384,7 @@ func (cli *DockerCli) CmdRun(args ...string) error { tag = DEFAULTTAG } - fmt.Printf("Unable to find image '%s' (tag: %s) locally\n", config.Image, tag) + fmt.Fprintf(cli.err, "Unable to find image '%s' (tag: %s) locally\n", config.Image, tag) v := url.Values{} repos, tag := utils.ParseRepositoryTag(config.Image) 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/container.go b/container.go index 9099d90f6..39c19c53d 100644 --- a/container.go +++ b/container.go @@ -107,7 +107,7 @@ type KeyValuePair struct { func ParseRun(args []string, capabilities *Capabilities) (*Config, *HostConfig, *flag.FlagSet, error) { cmd := Subcmd("run", "[OPTIONS] IMAGE [COMMAND] [ARG...]", "Run a command in a new container") - if len(args) > 0 && args[0] != "--help" { + if os.Getenv("TEST") != "" { cmd.SetOutput(ioutil.Discard) cmd.Usage = 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) } 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 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 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 <`_ 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..eef15d50c 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,14 +63,18 @@ 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 # 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 +128,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. @@ -136,7 +145,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 +160,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 +179,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..8b4676f6e 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``? ------------- @@ -140,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) 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 -------------- diff --git a/hack/release/make.sh b/hack/release/make.sh index 779229786..d68e4c048 100755 --- a/hack/release/make.sh +++ b/hack/release/make.sh @@ -52,7 +52,7 @@ private PaaS, service-oriented architectures, etc." UPSTART_SCRIPT='description "Docker daemon" -start on filesystem or runlevel [2345] +start on filesystem and started lxc-net stop on runlevel [!2345] respawn 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 diff --git a/runtime.go b/runtime.go index 13cd6a8e8..002c0fe10 100644 --- a/runtime.go +++ b/runtime.go @@ -208,7 +208,7 @@ func (runtime *Runtime) Destroy(container *Container) error { func (runtime *Runtime) restore() error { wheel := "-\\|/" - if os.Getenv("DEBUG") == "" { + if os.Getenv("DEBUG") == "" && os.Getenv("TEST") == "" { fmt.Printf("Loading containers: ") } dir, err := ioutil.ReadDir(runtime.repository) @@ -218,7 +218,7 @@ func (runtime *Runtime) restore() error { for i, v := range dir { id := v.Name() container, err := runtime.Load(id) - if i%21 == 0 && os.Getenv("DEBUG") == "" { + if i%21 == 0 && os.Getenv("DEBUG") == "" && os.Getenv("TEST") == "" { fmt.Printf("\b%c", wheel[i%4]) } if err != nil { @@ -227,7 +227,7 @@ func (runtime *Runtime) restore() error { } utils.Debugf("Loaded container %v", container.ID) } - if os.Getenv("DEBUG") == "" { + if os.Getenv("DEBUG") == "" && os.Getenv("TEST") == "" { fmt.Printf("\bdone.\n") } return nil diff --git a/runtime_test.go b/runtime_test.go index 83ada6dd2..a65d962fa 100644 --- a/runtime_test.go +++ b/runtime_test.go @@ -72,6 +72,8 @@ func layerArchive(tarfile string) (io.Reader, error) { } func init() { + os.Setenv("TEST", "1") + // Hack to run sys init during unit testing if selfPath := utils.SelfPath(); selfPath == "/sbin/init" || selfPath == "/.dockerinit" { SysInit() 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 == "" { diff --git a/utils/utils.go b/utils/utils.go index b26d80323..e8cf08aab 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -781,21 +781,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 = StripComments(resolvConf, []byte("#")) + 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 } +// 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 commentIndex = bytes.Index(currentLine, commentMarker) + if ( commentIndex == -1 ) { + output = append(output, currentLine...) + } else { + output = append(output, currentLine[:commentIndex]...) + } + output = append(output, []byte("\n")...) + } + return output +} + 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 20a5820dd..334165086 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