Merge pull request #1954 from metalivedev/1901-cherrypick-builddocker

1901 1929 1932 cherrypick to release and docs
This commit is contained in:
Andy Rothfusz 2013-09-20 18:13:11 -07:00
commit 2819cfb3f3
3 changed files with 100 additions and 31 deletions

View file

@ -3,7 +3,7 @@
:keywords: Docker, documentation, developers, contributing, dev environment
Setting Up a Dev Environment
============================
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To make it easier to contribute to Docker, we provide a standard
development environment. It is important that the same environment be
@ -12,11 +12,11 @@ environment defines all build dependencies: system libraries and
binaries, go environment, go dependencies, etc.
Step 1: install docker
Step 1: Install Docker
----------------------
Docker's build environment itself is a Docker container, so the first
step is to install docker on your system.
step is to install Docker on your system.
You can follow the `install instructions most relevant to your system
<https://docs.docker.io/en/latest/installation/>`_. Make sure you have
@ -24,40 +24,109 @@ a working, up-to-date docker installation, then continue to the next
step.
Step 2: check out the source
Step 2: Check out the Source
----------------------------
::
.. code-block:: bash
git clone http://git@github.com/dotcloud/docker
cd docker
To checkout a different revision just use ``git checkout`` with the name of branch or revision number.
Step 3: build
-------------
When you are ready to build docker, run this command:
Step 3: Build the Environment
-----------------------------
::
This following command will build a development environment using the Dockerfile in the current directory. Essentially, it will install all the build and runtime dependencies necessary to build and test Docker. This command will take some time to complete when you first execute it.
.. code-block:: bash
sudo docker build -t docker .
This will build the revision currently checked out in the
repository. Feel free to check out the version of your choice.
If the build is successful, congratulations! You have produced a clean
build of docker, neatly encapsulated in a standard build environment.
You can run an interactive session in the newly built container:
::
sudo docker run -i -t docker bash
To extract the binaries from the container:
If the build is successful, congratulations! You have produced a clean build of docker, neatly encapsulated in a standard build environment.
::
sudo docker run docker sh -c 'cat $(which docker)' > docker-build && chmod +x docker-build
Step 4: Build the Docker Binary
-------------------------------
To create the Docker binary, run this command:
.. code-block:: bash
sudo docker run -lxc-conf=lxc.aa_profile=unconfined -privileged -v `pwd`:/go/src/github.com/dotcloud/docker docker hack/make.sh binary
This will create the Docker binary in ``./bundles/<version>-dev/binary/``
Step 5: Run the Tests
---------------------
To run the Docker test cases you first need to disable `AppArmor <https://wiki.ubuntu.com/AppArmor>`_ using the following commands
.. code-block:: bash
sudo /etc/init.d/apparmor stop
sudo /etc/init.d/apparmor teardown
To execute the test cases, run this command:
.. code-block:: bash
sudo docker run -lxc-conf=lxc.aa_profile=unconfined -privileged -v `pwd`:/go/src/github.com/dotcloud/docker docker hack/make.sh test
If the test are successful then the tail of the output should look something like this
.. code-block:: bash
--- PASS: TestWriteBroadcaster (0.00 seconds)
=== RUN TestRaceWriteBroadcaster
--- PASS: TestRaceWriteBroadcaster (0.00 seconds)
=== RUN TestTruncIndex
--- PASS: TestTruncIndex (0.00 seconds)
=== RUN TestCompareKernelVersion
--- PASS: TestCompareKernelVersion (0.00 seconds)
=== RUN TestHumanSize
--- PASS: TestHumanSize (0.00 seconds)
=== RUN TestParseHost
--- PASS: TestParseHost (0.00 seconds)
=== RUN TestParseRepositoryTag
--- PASS: TestParseRepositoryTag (0.00 seconds)
=== RUN TestGetResolvConf
--- PASS: TestGetResolvConf (0.00 seconds)
=== RUN TestCheckLocalDns
--- PASS: TestCheckLocalDns (0.00 seconds)
=== RUN TestParseRelease
--- PASS: TestParseRelease (0.00 seconds)
=== RUN TestDependencyGraphCircular
--- PASS: TestDependencyGraphCircular (0.00 seconds)
=== RUN TestDependencyGraph
--- PASS: TestDependencyGraph (0.00 seconds)
PASS
ok github.com/dotcloud/docker/utils 0.017s
Step 6: Use Docker
-------------------
You can run an interactive session in the newly built container:
.. code-block:: bash
sudo docker run -privileged -i -t docker bash
# type 'exit' to exit
.. note:: The binary is availalbe outside the container in the directory ``./bundles/<version>-dev/binary/``.
**Need More Help?**
If you need more help then hop on to the `#docker-dev IRC channel <irc://chat.freenode.net#docker-dev>`_ or post a message on the `Docker developer mailinglist <https://groups.google.com/d/forum/docker-dev>`_.

View file

@ -25,15 +25,11 @@ Ensure that layman is installed:
sudo emerge -av app-portage/layman
Using your favorite editor, add
``https://raw.github.com/tianon/docker-overlay/master/repositories.xml`` to the
``overlays`` section in ``/etc/layman/layman.cfg`` (as per instructions on the
`Gentoo Wiki <http://wiki.gentoo.org/wiki/Layman#Adding_custom_overlays>`_),
then invoke the following:
Add the "docker" overlay using layman:
.. code-block:: bash
sudo layman -f -a docker
sudo layman -a docker
Once that completes, the ``app-emulation/docker`` package will be available
for emerge:
@ -44,7 +40,7 @@ for emerge:
If you prefer to use the official binaries, or just do not wish to compile
docker, emerge ``app-emulation/docker-bin`` instead. It is important to
remember that Gentoo is still an unsupported platform, even when using the
remember that Gentoo is still an unofficial platform, even when using the
official binaries.
The package should already include all the necessary dependencies. For the
@ -123,3 +119,7 @@ Unfortunately, Gentoo suffers from `issue #1422
fresh start of docker, the first docker run fails due to some tricky terminal
issues, so be sure to run something trivial (such as ``docker run -i -t busybox
echo hi``) before attempting to run anything important.
There is a tentative (and very hacky) workaround for this in the OpenRC init
script, and it can be enabled by modifying the appropriate value in
``/etc/conf.d/docker`` after successful installation.

View file

@ -129,7 +129,7 @@ to follow them again.*
# 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 -"
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 http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"