devenvironment.rst 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. :title: Setting Up a Dev Environment
  2. :description: Guides on how to contribute to docker
  3. :keywords: Docker, documentation, developers, contributing, dev environment
  4. Setting Up a Dev Environment
  5. ============================
  6. To make it easier to contribute to Docker, we provide a standard
  7. development environment. It is important that the same environment be
  8. used for all tests, builds and releases. The standard development
  9. environment defines all build dependencies: system libraries and
  10. binaries, go environment, go dependencies, etc.
  11. Step 1: Install Docker
  12. ----------------------
  13. Docker's build environment itself is a Docker container, so the first
  14. step is to install Docker on your system.
  15. You can follow the `install instructions most relevant to your system
  16. <https://docs.docker.io/en/latest/installation/>`_. Make sure you have
  17. a working, up-to-date docker installation, then continue to the next
  18. step.
  19. Step 2: Check out the Source
  20. ----------------------------
  21. ::
  22. git clone http://git@github.com/dotcloud/docker
  23. cd docker
  24. To checkout a different revision just use ``git checkout`` with the name of branch or revision number.
  25. Step 3: Build Docker
  26. ---------------------
  27. When you are ready to build docker, run this command:
  28. ::
  29. sudo docker build -t docker .
  30. 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.
  31. If the build is successful, congratulations! You have produced a clean build of docker, neatly encapsulated in a standard build environment.
  32. Step 4: Testing the Docker Build
  33. ---------------------------------
  34. If you have successfully complete the previous steps then you can test the Docker build by executing the following command
  35. ::
  36. sudo docker run -lxc-conf=lxc.aa_profile=unconfined -privileged -v `pwd`:/go/src/github.com/dotcloud/docker docker hack/make.sh test
  37. Step 5: Use Docker
  38. -------------------
  39. You can run an interactive session in the newly built container:
  40. ::
  41. sudo docker run -privileged -i -t docker bash
  42. To exit the interactive session simply type ``exit``.
  43. To extract the binaries from the container:
  44. ::
  45. sudo docker run docker sh -c 'cat $(which docker)' > docker-build && chmod +x docker-build
  46. Need More Help?
  47. ===============
  48. If you need more help then hop on to the #docker-dev IRC channel.