github.com/hustcat/docker@v1.3.3-0.20160314103604-901c67a8eeab/CONTRIBUTING.md (about) 1 # Contributing to Docker 2 3 Want to hack on Docker? Awesome! We have a contributor's guide that explains 4 [setting up a Docker development environment and the contribution 5 process](https://docs.docker.com/opensource/project/who-written-for/). 6 7 ![Contributors guide](docs/static_files/contributors.png) 8 9 This page contains information about reporting issues as well as some tips and 10 guidelines useful to experienced open source contributors. Finally, make sure 11 you read our [community guidelines](#docker-community-guidelines) before you 12 start participating. 13 14 ## Topics 15 16 * [Reporting Security Issues](#reporting-security-issues) 17 * [Design and Cleanup Proposals](#design-and-cleanup-proposals) 18 * [Reporting Issues](#reporting-other-issues) 19 * [Quick Contribution Tips and Guidelines](#quick-contribution-tips-and-guidelines) 20 * [Community Guidelines](#docker-community-guidelines) 21 22 ## Reporting security issues 23 24 The Docker maintainers take security seriously. If you discover a security 25 issue, please bring it to their attention right away! 26 27 Please **DO NOT** file a public issue, instead send your report privately to 28 [security@docker.com](mailto:security@docker.com). 29 30 Security reports are greatly appreciated and we will publicly thank you for it. 31 We also like to send gifts—if you're into Docker schwag, make sure to let 32 us know. We currently do not offer a paid security bounty program, but are not 33 ruling it out in the future. 34 35 36 ## Reporting other issues 37 38 A great way to contribute to the project is to send a detailed report when you 39 encounter an issue. We always appreciate a well-written, thorough bug report, 40 and will thank you for it! 41 42 Check that [our issue database](https://github.com/docker/docker/issues) 43 doesn't already include that problem or suggestion before submitting an issue. 44 If you find a match, you can use the "subscribe" button to get notified on 45 updates. Do *not* leave random "+1" or "I have this too" comments, as they 46 only clutter the discussion, and don't help resolving it. However, if you 47 have ways to reproduce the issue or have additional information that may help 48 resolving the issue, please leave a comment. 49 50 When reporting issues, always include: 51 52 * The output of `docker version`. 53 * The output of `docker info`. 54 55 Also include the steps required to reproduce the problem if possible and 56 applicable. This information will help us review and fix your issue faster. 57 When sending lengthy log-files, consider posting them as a gist (https://gist.github.com). 58 Don't forget to remove sensitive data from your logfiles before posting (you can 59 replace those parts with "REDACTED"). 60 61 **Issue Report Template**: 62 63 ``` 64 Description of problem: 65 66 67 `docker version`: 68 69 70 `docker info`: 71 72 73 `uname -a`: 74 75 76 Environment details (AWS, VirtualBox, physical, etc.): 77 78 79 How reproducible: 80 81 82 Steps to Reproduce: 83 1. 84 2. 85 3. 86 87 88 Actual Results: 89 90 91 Expected Results: 92 93 94 Additional info: 95 96 97 98 ``` 99 100 101 ##Quick contribution tips and guidelines 102 103 This section gives the experienced contributor some tips and guidelines. 104 105 ###Pull requests are always welcome 106 107 Not sure if that typo is worth a pull request? Found a bug and know how to fix 108 it? Do it! We will appreciate it. Any significant improvement should be 109 documented as [a GitHub issue](https://github.com/docker/docker/issues) before 110 anybody starts working on it. 111 112 We are always thrilled to receive pull requests. We do our best to process them 113 quickly. If your pull request is not accepted on the first try, 114 don't get discouraged! Our contributor's guide explains [the review process we 115 use for simple changes](https://docs.docker.com/opensource/workflow/make-a-contribution/). 116 117 ### Design and cleanup proposals 118 119 You can propose new designs for existing Docker features. You can also design 120 entirely new features. We really appreciate contributors who want to refactor or 121 otherwise cleanup our project. For information on making these types of 122 contributions, see [the advanced contribution 123 section](https://docs.docker.com/opensource/workflow/advanced-contributing/) in 124 the contributors guide. 125 126 We try hard to keep Docker lean and focused. Docker can't do everything for 127 everybody. This means that we might decide against incorporating a new feature. 128 However, there might be a way to implement that feature *on top of* Docker. 129 130 ### Talking to other Docker users and contributors 131 132 <table class="tg"> 133 <col width="45%"> 134 <col width="65%"> 135 <tr> 136 <td>Internet Relay Chat (IRC)</td> 137 <td> 138 <p> 139 IRC a direct line to our most knowledgeable Docker users; we have 140 both the <code>#docker</code> and <code>#docker-dev</code> group on 141 <strong>irc.freenode.net</strong>. 142 IRC is a rich chat protocol but it can overwhelm new users. You can search 143 <a href="https://botbot.me/freenode/docker/#" target="_blank">our chat archives</a>. 144 </p> 145 Read our <a href="https://docs.docker.com/opensource/get-help/#irc-quickstart" target="_blank">IRC quickstart guide</a> for an easy way to get started. 146 </td> 147 </tr> 148 <tr> 149 <td>Google Groups</td> 150 <td> 151 There are two groups. 152 <a href="https://groups.google.com/forum/#!forum/docker-user" target="_blank">Docker-user</a> 153 is for people using Docker containers. 154 The <a href="https://groups.google.com/forum/#!forum/docker-dev" target="_blank">docker-dev</a> 155 group is for contributors and other people contributing to the Docker 156 project. 157 You can join them without an google account by sending an email to e.g. "docker-user+subscribe@googlegroups.com". 158 After receiving the join-request message, you can simply reply to that to confirm the subscribtion. 159 </td> 160 </tr> 161 <tr> 162 <td>Twitter</td> 163 <td> 164 You can follow <a href="https://twitter.com/docker/" target="_blank">Docker's Twitter feed</a> 165 to get updates on our products. You can also tweet us questions or just 166 share blogs or stories. 167 </td> 168 </tr> 169 <tr> 170 <td>Stack Overflow</td> 171 <td> 172 Stack Overflow has over 17000 Docker questions listed. We regularly 173 monitor <a href="https://stackoverflow.com/search?tab=newest&q=docker" target="_blank">Docker questions</a> 174 and so do many other knowledgeable Docker users. 175 </td> 176 </tr> 177 </table> 178 179 180 ### Conventions 181 182 Fork the repository and make changes on your fork in a feature branch: 183 184 - If it's a bug fix branch, name it XXXX-something where XXXX is the number of 185 the issue. 186 - If it's a feature branch, create an enhancement issue to announce 187 your intentions, and name it XXXX-something where XXXX is the number of the 188 issue. 189 190 Submit unit tests for your changes. Go has a great test framework built in; use 191 it! Take a look at existing tests for inspiration. [Run the full test 192 suite](https://docs.docker.com/opensource/project/test-and-docs/) on your branch before 193 submitting a pull request. 194 195 Update the documentation when creating or modifying features. Test your 196 documentation changes for clarity, concision, and correctness, as well as a 197 clean documentation build. See our contributors guide for [our style 198 guide](https://docs.docker.com/opensource/doc-style) and instructions on [building 199 the documentation](https://docs.docker.com/opensource/project/test-and-docs/#build-and-test-the-documentation). 200 201 Write clean code. Universally formatted code promotes ease of writing, reading, 202 and maintenance. Always run `gofmt -s -w file.go` on each changed file before 203 committing your changes. Most editors have plug-ins that do this automatically. 204 205 Pull request descriptions should be as clear as possible and include a reference 206 to all the issues that they address. 207 208 Commit messages must start with a capitalized and short summary (max. 50 chars) 209 written in the imperative, followed by an optional, more detailed explanatory 210 text which is separated from the summary by an empty line. 211 212 Code review comments may be added to your pull request. Discuss, then make the 213 suggested modifications and push additional commits to your feature branch. Post 214 a comment after pushing. New commits show up in the pull request automatically, 215 but the reviewers are notified only when you comment. 216 217 Pull requests must be cleanly rebased on top of master without multiple branches 218 mixed into the PR. 219 220 **Git tip**: If your PR no longer merges cleanly, use `rebase master` in your 221 feature branch to update your pull request rather than `merge master`. 222 223 Before you make a pull request, squash your commits into logical units of work 224 using `git rebase -i` and `git push -f`. A logical unit of work is a consistent 225 set of patches that should be reviewed together: for example, upgrading the 226 version of a vendored dependency and taking advantage of its now available new 227 feature constitute two separate units of work. Implementing a new function and 228 calling it in another file constitute a single logical unit of work. The very 229 high majority of submissions should have a single commit, so if in doubt: squash 230 down to one. 231 232 After every commit, [make sure the test suite passes] 233 (https://docs.docker.com/opensource/project/test-and-docs/). Include documentation 234 changes in the same pull request so that a revert would remove all traces of 235 the feature or fix. 236 237 Include an issue reference like `Closes #XXXX` or `Fixes #XXXX` in commits that 238 close an issue. Including references automatically closes the issue on a merge. 239 240 Please do not add yourself to the `AUTHORS` file, as it is regenerated regularly 241 from the Git history. 242 243 Please see the [Coding Style](#coding-style) for further guidelines. 244 245 ### Merge approval 246 247 Docker maintainers use LGTM (Looks Good To Me) in comments on the code review to 248 indicate acceptance. 249 250 A change requires LGTMs from an absolute majority of the maintainers of each 251 component affected. For example, if a change affects `docs/` and `registry/`, it 252 needs an absolute majority from the maintainers of `docs/` AND, separately, an 253 absolute majority of the maintainers of `registry/`. 254 255 For more details, see the [MAINTAINERS](MAINTAINERS) page. 256 257 ### Sign your work 258 259 The sign-off is a simple line at the end of the explanation for the patch. Your 260 signature certifies that you wrote the patch or otherwise have the right to pass 261 it on as an open-source patch. The rules are pretty simple: if you can certify 262 the below (from [developercertificate.org](http://developercertificate.org/)): 263 264 ``` 265 Developer Certificate of Origin 266 Version 1.1 267 268 Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 269 660 York Street, Suite 102, 270 San Francisco, CA 94110 USA 271 272 Everyone is permitted to copy and distribute verbatim copies of this 273 license document, but changing it is not allowed. 274 275 Developer's Certificate of Origin 1.1 276 277 By making a contribution to this project, I certify that: 278 279 (a) The contribution was created in whole or in part by me and I 280 have the right to submit it under the open source license 281 indicated in the file; or 282 283 (b) The contribution is based upon previous work that, to the best 284 of my knowledge, is covered under an appropriate open source 285 license and I have the right under that license to submit that 286 work with modifications, whether created in whole or in part 287 by me, under the same open source license (unless I am 288 permitted to submit under a different license), as indicated 289 in the file; or 290 291 (c) The contribution was provided directly to me by some other 292 person who certified (a), (b) or (c) and I have not modified 293 it. 294 295 (d) I understand and agree that this project and the contribution 296 are public and that a record of the contribution (including all 297 personal information I submit with it, including my sign-off) is 298 maintained indefinitely and may be redistributed consistent with 299 this project or the open source license(s) involved. 300 ``` 301 302 Then you just add a line to every git commit message: 303 304 Signed-off-by: Joe Smith <joe.smith@email.com> 305 306 Use your real name (sorry, no pseudonyms or anonymous contributions.) 307 308 If you set your `user.name` and `user.email` git configs, you can sign your 309 commit automatically with `git commit -s`. 310 311 Note that the old-style `Docker-DCO-1.1-Signed-off-by: ...` format is still 312 accepted, so there is no need to update outstanding pull requests to the new 313 format right away, but please do adjust your processes for future contributions. 314 315 ### How can I become a maintainer? 316 317 The procedures for adding new maintainers are explained in the 318 global [MAINTAINERS](https://github.com/docker/opensource/blob/master/MAINTAINERS) 319 file in the [https://github.com/docker/opensource/](https://github.com/docker/opensource/) 320 repository. 321 322 Don't forget: being a maintainer is a time investment. Make sure you 323 will have time to make yourself available. You don't have to be a 324 maintainer to make a difference on the project! 325 326 ## Docker community guidelines 327 328 We want to keep the Docker community awesome, growing and collaborative. We need 329 your help to keep it that way. To help with this we've come up with some general 330 guidelines for the community as a whole: 331 332 * Be nice: Be courteous, respectful and polite to fellow community members: 333 no regional, racial, gender, or other abuse will be tolerated. We like 334 nice people way better than mean ones! 335 336 * Encourage diversity and participation: Make everyone in our community feel 337 welcome, regardless of their background and the extent of their 338 contributions, and do everything possible to encourage participation in 339 our community. 340 341 * Keep it legal: Basically, don't get us in trouble. Share only content that 342 you own, do not share private or sensitive information, and don't break 343 the law. 344 345 * Stay on topic: Make sure that you are posting to the correct channel and 346 avoid off-topic discussions. Remember when you update an issue or respond 347 to an email you are potentially sending to a large number of people. Please 348 consider this before you update. Also remember that nobody likes spam. 349 350 * Don't send email to the maintainers: There's no need to send email to the 351 maintainers to ask them to investigate an issue or to take a look at a 352 pull request. Instead of sending an email, GitHub mentions should be 353 used to ping maintainers to review a pull request, a proposal or an 354 issue. 355 356 ### Guideline violations — 3 strikes method 357 358 The point of this section is not to find opportunities to punish people, but we 359 do need a fair way to deal with people who are making our community suck. 360 361 1. First occurrence: We'll give you a friendly, but public reminder that the 362 behavior is inappropriate according to our guidelines. 363 364 2. Second occurrence: We will send you a private message with a warning that 365 any additional violations will result in removal from the community. 366 367 3. Third occurrence: Depending on the violation, we may need to delete or ban 368 your account. 369 370 **Notes:** 371 372 * Obvious spammers are banned on first occurrence. If we don't do this, we'll 373 have spam all over the place. 374 375 * Violations are forgiven after 6 months of good behavior, and we won't hold a 376 grudge. 377 378 * People who commit minor infractions will get some education, rather than 379 hammering them in the 3 strikes process. 380 381 * The rules apply equally to everyone in the community, no matter how much 382 you've contributed. 383 384 * Extreme violations of a threatening, abusive, destructive or illegal nature 385 will be addressed immediately and are not subject to 3 strikes or forgiveness. 386 387 * Contact abuse@docker.com to report abuse or appeal violations. In the case of 388 appeals, we know that mistakes happen, and we'll work with you to come up with a 389 fair solution if there has been a misunderstanding. 390 391 ## Coding Style 392 393 Unless explicitly stated, we follow all coding guidelines from the Go 394 community. While some of these standards may seem arbitrary, they somehow seem 395 to result in a solid, consistent codebase. 396 397 It is possible that the code base does not currently comply with these 398 guidelines. We are not looking for a massive PR that fixes this, since that 399 goes against the spirit of the guidelines. All new contributions should make a 400 best effort to clean up and make the code base better than they left it. 401 Obviously, apply your best judgement. Remember, the goal here is to make the 402 code base easier for humans to navigate and understand. Always keep that in 403 mind when nudging others to comply. 404 405 The rules: 406 407 1. All code should be formatted with `gofmt -s`. 408 2. All code should pass the default levels of 409 [`golint`](https://github.com/golang/lint). 410 3. All code should follow the guidelines covered in [Effective 411 Go](http://golang.org/doc/effective_go.html) and [Go Code Review 412 Comments](https://github.com/golang/go/wiki/CodeReviewComments). 413 4. Comment the code. Tell us the why, the history and the context. 414 5. Document _all_ declarations and methods, even private ones. Declare 415 expectations, caveats and anything else that may be important. If a type 416 gets exported, having the comments already there will ensure it's ready. 417 6. Variable name length should be proportional to it's context and no longer. 418 `noCommaALongVariableNameLikeThisIsNotMoreClearWhenASimpleCommentWouldDo`. 419 In practice, short methods will have short variable names and globals will 420 have longer names. 421 7. No underscores in package names. If you need a compound name, step back, 422 and re-examine why you need a compound name. If you still think you need a 423 compound name, lose the underscore. 424 8. No utils or helpers packages. If a function is not general enough to 425 warrant it's own package, it has not been written generally enough to be a 426 part of a util package. Just leave it unexported and well-documented. 427 9. All tests should run with `go test` and outside tooling should not be 428 required. No, we don't need another unit testing framework. Assertion 429 packages are acceptable if they provide _real_ incremental value. 430 10. Even though we call these "rules" above, they are actually just 431 guidelines. Since you've read all the rules, you now know that. 432 433 If you are having trouble getting into the mood of idiomatic Go, we recommend 434 reading through [Effective Go](http://golang.org/doc/effective_go.html). The 435 [Go Blog](http://blog.golang.org/) is also a great resource. Drinking the 436 kool-aid is a lot easier than going thirsty.