github.com/akashshinde/docker@v1.9.1/docs/README.md (about)

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