github.com/guilhermebr/docker@v1.4.2-0.20150428121140-67da055cebca/docs/README.md (about)

     1  # Docker Documentation
     2  
     3  The source for Docker documentation is in this directory under `sources/`. Our
     4  documentation uses extended Markdown, as implemented by
     5  [MkDocs](http://mkdocs.org).  The current release of the Docker documentation
     6  resides on [https://docs.docker.com](https://docs.docker.com).
     7  
     8  ## Understanding the documentation branches and processes
     9  
    10  Docker has two primary branches for documentation:
    11  
    12  | Branch   | Description                    | URL (published via commit-hook)                                              |
    13  |----------|--------------------------------|------------------------------------------------------------------------------|
    14  | `docs`   | Official release documentation | [https://docs.docker.com](https://docs.docker.com)                             |
    15  | `master` | Merged but unreleased development work    | [http://docs.master.dockerproject.com](http://docs.master.dockerproject.com) |
    16  
    17  Additions and updates to upcoming releases are made in a feature branch off of
    18  the `master` branch. The Docker maintainers also support a `docs` branch that
    19  contains the last release of documentation.
    20  
    21  After a release, documentation updates are continually merged into `master` as
    22  they occur. This work includes new documentation for forthcoming features, bug
    23  fixes, and other updates. Docker's CI system automatically builds and updates
    24  the `master` documentation after each merge and posts it to
    25  [http://docs.master.dockerproject.com](http://docs.master.dockerproject.com). 
    26  
    27  Periodically, the Docker maintainers update `docs.docker.com` between official
    28  releases of Docker. They do this by cherry-picking commits from `master`,
    29  merging them into `docs`,  and then publishing the result.
    30  
    31  In the rare case where a change is not forward-compatible, changes may be made
    32  on other branches by special arrangement with the Docker maintainers.
    33  
    34  ### Quickstart for documentation contributors
    35  
    36  If you are a new or beginner contributor, we encourage you to read through the
    37  [our detailed contributors
    38  guide](https://docs.docker.com/project/who-written-for/). The guide explains in
    39  detail, with examples, how to contribute. If you are an experienced contributor
    40  this quickstart should be enough to get you started.
    41  
    42  The following is the essential workflow for contributing to the documentation:
    43  
    44  1. Fork the `docker/docker` repository.
    45  
    46  2. Clone the repository to your local machine.
    47  
    48  3. Select an issue from `docker/docker` to work on or submit a proposal of your
    49  own.
    50  
    51  4. Create a feature branch from `master` in which to work.
    52  
    53  	By basing from `master` your work is automatically included in the next
    54  	release. It also allows docs maintainers to easily cherry-pick your changes
    55  	into the `docs` release branch. 
    56  
    57  4. Modify existing or add new `.md` files to the `docs/sources` directory.
    58  
    59  	If you add a new document (`.md`) file, you must also add it to the
    60  	appropriate section of the `docs/mkdocs.yml` file in this repository.
    61  
    62  
    63  5.  As you work, build the documentation site locally to see your changes.
    64  
    65  	The `docker/docker` repository contains a `Dockerfile` and a `Makefile`.
    66  	Together, these create a development environment in which you can build and
    67  	run a container running the Docker documentation website. To build the
    68  	documentation site, enter `make docs` at the root of your `docker/docker`
    69  	fork:
    70  	
    71  		$ make docs
    72  		.... (lots of output) ....
    73  		docker run --rm -it  -e AWS_S3_BUCKET -p 8000:8000 "docker-docs:master" mkdocs serve
    74  		Running at: http://0.0.0.0:8000/
    75  		Live reload enabled.
    76  		Hold ctrl+c to quit.
    77  	
    78  	
    79  	The build creates an image containing all the required tools, adds the local
    80  	`docs/` directory and generates the HTML files. Then, it runs a Docker
    81  	container with this image.
    82  
    83  	The container exposes port 8000 on the localhost so that you can connect and
    84  	see your changes. If you are running Boot2Docker, use the `boot2docker ip`
    85  	to get the address of your server.
    86  
    87  6.  Check your writing for style and mechanical errors.
    88  
    89  	Use our [documentation style
    90  	guide](https://docs.docker.com/project/doc-style/) to check style. There are
    91  	several [good grammar and spelling online
    92  	checkers](http://www.hemingwayapp.com/) that can check your writing
    93  	mechanics.
    94  
    95  7.  Squash your commits on your branch.
    96  
    97  8.  Make a pull request from your fork back to Docker's `master` branch.
    98  
    99  9.  Work with the reviewers until your change is approved and merged.
   100  
   101  ### Debugging and testing
   102  
   103  If you have any issues you need to debug, you can use `make docs-shell` and then
   104  run `mkdocs serve`. You can use `make docs-test` to generate a report of missing
   105  links that are referenced in the documentation—there should be none.
   106  
   107  ## Style guide
   108  
   109  If you have questions about how to write for Docker's documentation, please see
   110  the [style guide](sources/project/doc-style.md). The style guide provides
   111  guidance about grammar, syntax, formatting, styling, language, or tone. If
   112  something isn't clear in the guide, please submit an issue to let us know or
   113  submit a pull request to help us improve it.
   114  
   115  
   116  ## Publishing documentation (for Docker maintainers)
   117  
   118  To publish Docker's documentation you need to have Docker up and running on your
   119  machine. You'll also need a `docs/awsconfig` file containing the settings you
   120  need to access the AWS bucket you'll be deploying to.
   121  
   122  The process for publishing is to build first to an AWS bucket, verify the build,
   123  and then publish the final release.
   124  
   125  1. Have Docker installed and running on your machine.
   126  
   127  2. Ask the core maintainers for the `awsconfig` file.
   128  
   129  3. Copy the `awsconfig` file to the `docs/` directory.
   130  
   131  	The `awsconfig` file contains the profiles of the S3 buckets for our
   132  	documentation sites. (If needed, the release script creates an S3 bucket and
   133  	pushes the files to it.)  Each profile has this format:
   134  
   135  		[profile dowideit-docs]
   136  		aws_access_key_id = IHOIUAHSIDH234rwf....
   137  		aws_secret_access_key = OIUYSADJHLKUHQWIUHE......
   138  		region = ap-southeast-2
   139  
   140  	The `profile` name must be the same as the name of the bucket you are
   141  	deploying to.
   142  
   143  4. Call the `make` from the `docker` directory.
   144  
   145      	$ make AWS_S3_BUCKET=dowideit-docs docs-release
   146  
   147  	This publishes _only_ to the `http://bucket-url/v1.2/` version of the
   148  	documentation.
   149  
   150  5.  If you're publishing the current release's documentation, you need to also
   151  update the root docs pages by running
   152  
   153       	$ make AWS_S3_BUCKET=dowideit-docs BUILD_ROOT=yes docs-release
   154  
   155  ### Errors publishing using Boot2Docker
   156  
   157  Sometimes, in a Boot2Docker environment, the publishing procedure returns this
   158  error:
   159  
   160  	Post http:///var/run/docker.sock/build?rm=1&t=docker-docs%3Apost-1.2.0-docs_update-2:
   161  	dial unix /var/run/docker.sock: no such file or directory.
   162  
   163  If this happens, set the Docker host. Run the following command to set the
   164  variables in your shell:
   165  
   166  		$ eval "$(boot2docker shellinit)"
   167  
   168  ## Cherry-picking documentation changes to update an existing release.
   169  
   170  Whenever the core team makes a release, they publish the documentation based on
   171  the `release` branch. At that time, the  `release` branch is copied into the
   172  `docs` branch. The documentation team makes updates between Docker releases by
   173  cherry-picking changes from `master` into any of the documentation branches.
   174  Typically, we cherry-pick into the `docs` branch.
   175  
   176  For example, to update the current release's docs, do the following:
   177  
   178  1. Go to your `docker/docker` fork and get the latest from master.
   179  
   180      	$ git fetch upstream
   181          
   182  2. Checkout a new branch based on `upstream/docs`.
   183  
   184  	You should give your new branch a descriptive name.
   185  
   186  		$ git checkout -b post-1.2.0-docs-update-1 upstream/docs
   187  	
   188  3. In a browser window, open [https://github.com/docker/docker/commits/master].
   189  
   190  4. Locate the merges you want to publish.
   191  
   192  	You should only cherry-pick individual commits; do not cherry-pick merge
   193  	commits. To minimize merge conflicts, start with the oldest commit and work
   194  	your way forward in time.
   195  
   196  5. Copy the commit SHA from GitHub.
   197  
   198  6. Cherry-pick the commit.
   199  	
   200  	 	$ git cherry-pick -x fe845c4
   201  	
   202  7. Repeat until you have cherry-picked everything you want to merge.
   203  
   204  8. Push your changes to your fork.
   205  
   206      	$ git push origin post-1.2.0-docs-update-1
   207  
   208  9. Make a pull request to merge into the `docs` branch.
   209  
   210  	Do __NOT__ merge into `master`.
   211  
   212  10. Have maintainers review your pull request.
   213  
   214  11. Once the PR has the needed "LGTMs", merge it on GitHub.
   215  
   216  12. Return to your local fork and make sure you are still on the `docs` branch.
   217  
   218  		$ git checkout docs
   219  
   220  13. Fetch your merged pull request from `docs`.
   221  
   222  		$ git fetch upstream/docs
   223  	
   224  14. Ensure your branch is clean and set to the latest.
   225  
   226     	 	$ git reset --hard upstream/docs
   227      
   228  15. Copy the `awsconfig` file into the `docs` directory.
   229      
   230  16. Make the beta documentation
   231  
   232      	$ make AWS_S3_BUCKET=beta-docs.docker.io BUILD_ROOT=yes docs-release
   233  
   234  17. Open [the beta
   235  website](http://beta-docs.docker.io.s3-website-us-west-2.amazonaws.com/) site
   236  and make sure what you published is correct.
   237  
   238  19. When you're happy with your content, publish the docs to our live site:
   239  
   240     		$ make AWS_S3_BUCKET=docs.docker.com BUILD_ROOT=yes
   241  DISTRIBUTION_ID=C2K6......FL2F docs-release
   242  
   243  20. Test the uncached version of the live docs at [http://docs.docker.com.s3-website-us-east-1.amazonaws.com/]
   244  
   245  
   246  ### Caching and the docs
   247  
   248  New docs do not appear live on the site until the cache (a complex, distributed
   249  CDN system) is flushed. The `make docs-release` command flushes the cache _if_
   250  the `DISTRIBUTION_ID` is set to the Cloudfront distribution ID. The cache flush
   251  can take at least 15 minutes to run and you can check its progress with the CDN
   252  Cloudfront Purge Tool Chrome app.
   253  
   254  ## Removing files from the docs.docker.com site
   255  
   256  Sometimes it becomes necessary to remove files from the historical published documentation.
   257  The most reliable way to do this is to do it directly using `aws s3` commands running in a
   258  docs container:
   259  
   260  Start the docs container like `make docs-shell`, but bind mount in your `awsconfig`:
   261  
   262  ```
   263  docker run --rm -it -v $(CURDIR)/docs/awsconfig:/docs/awsconfig docker-docs:master bash
   264  ```
   265  
   266  and then the following example shows deleting 2 documents from s3, and then requesting the
   267  CloudFlare cache to invalidate them:
   268  
   269  
   270  ```
   271  export BUCKET BUCKET=docs.docker.com
   272  export AWS_CONFIG_FILE=$(pwd)/awsconfig
   273  aws s3 --profile $BUCKET ls s3://$BUCKET
   274  aws s3 --profile $BUCKET rm s3://$BUCKET/v1.0/reference/api/docker_io_oauth_api/index.html
   275  aws s3 --profile $BUCKET rm s3://$BUCKET/v1.1/reference/api/docker_io_oauth_api/index.html
   276  
   277  aws configure set preview.cloudfront true
   278  export DISTRIBUTION_ID=YUTIYUTIUTIUYTIUT
   279  aws cloudfront  create-invalidation --profile docs.docker.com --distribution-id $DISTRIBUTION_ID --invalidation-batch '{"Paths":{"Quantity":1, "Items":["/v1.0/reference/api/docker_io_oauth_api/"]},"CallerReference":"6Mar2015sventest1"}'
   280  aws cloudfront  create-invalidation --profile docs.docker.com --distribution-id $DISTRIBUTION_ID --invalidation-batch '{"Paths":{"Quantity":1, "Items":["/v1.1/reference/api/docker_io_oauth_api/"]},"CallerReference":"6Mar2015sventest1"}'
   281  ```
   282  
   283  ### Generate the man pages for Mac OSX
   284  
   285  When using Docker on Mac OSX the man pages will be missing by default. You can manually generate them by following these steps:
   286  
   287  1. Checkout the docker source. You must clone into your `/Users` directory because Boot2Docker can only share this path
   288     with the docker containers.
   289  
   290          $ git clone https://github.com/docker/docker.git
   291  		
   292  2. Build the docker image.
   293     
   294          $ cd docker/docs/man
   295          $ docker build -t docker/md2man .
   296  
   297  3. Build the man pages.
   298  
   299          $ docker run -v /Users/<path-to-git-dir>/docker/docs/man:/docs:rw -w /docs -i docker/md2man /docs/md2man-all.sh
   300  
   301  4. Copy the generated man pages to `/usr/share/man`
   302  
   303          $ cp -R man* /usr/share/man/