Updated the dev environment document

This commit is contained in:
Jim Alateras 2013-09-18 12:41:12 +10:00
Родитель 76a07371c5
Коммит 4054f31471
1 изменённых файлов: 71 добавлений и 18 удалений

Просмотреть файл

@ -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
@ -27,7 +27,7 @@ step.
Step 2: Check out the Source
----------------------------
::
.. code-block:: bash
git clone http://git@github.com/dotcloud/docker
cd docker
@ -35,51 +35,104 @@ Step 2: Check out the Source
To checkout a different revision just use ``git checkout`` with the name of branch or revision number.
Step 3: Build Docker
---------------------
Step 3: Build the Environment
-----------------------------
When you are ready to build docker, run this command:
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 a container 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.
If the build is successful, congratulations! You have produced a clean build of docker, neatly encapsulated in a standard build environment.
Step 4: Testing the Docker Build
---------------------------------
Step 4: Build the Docker Binary
-------------------------------
If you have successfully complete the previous steps then you can test the Docker build by executing the following command
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
Step 5: Use Docker
If the test are successful then the tail of the output should look something like this
::
--- 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
To exit the interactive session simply type ``exit``.
# type 'exit' to exit
To extract the binaries from the container:
::
.. code-block:: bash
sudo docker run docker sh -c 'cat $(which docker)' > docker-build && chmod +x docker-build
Need More Help?
===============
**Need More Help?**
If you need more help then hop on to the #docker-dev IRC channel.
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>`_.