github.com/uriddle/docker@v0.0.0-20210926094723-4072e6aeb013/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 </td> 158 </tr> 159 <tr> 160 <td>Twitter</td> 161 <td> 162 You can follow <a href="https://twitter.com/docker/" target="_blank">Docker's Twitter feed</a> 163 to get updates on our products. You can also tweet us questions or just 164 share blogs or stories. 165 </td> 166 </tr> 167 <tr> 168 <td>Stack Overflow</td> 169 <td> 170 Stack Overflow has over 17000 Docker questions listed. We regularly 171 monitor <a href="https://stackoverflow.com/search?tab=newest&q=docker" target="_blank">Docker questions</a> 172 and so do many other knowledgeable Docker users. 173 </td> 174 </tr> 175 </table> 176 177 178 ### Conventions 179 180 Fork the repository and make changes on your fork in a feature branch: 181 182 - If it's a bug fix branch, name it XXXX-something where XXXX is the number of 183 the issue. 184 - If it's a feature branch, create an enhancement issue to announce 185 your intentions, and name it XXXX-something where XXXX is the number of the 186 issue. 187 188 Submit unit tests for your changes. Go has a great test framework built in; use 189 it! Take a look at existing tests for inspiration. [Run the full test 190 suite](https://docs.docker.com/opensource/project/test-and-docs/) on your branch before 191 submitting a pull request. 192 193 Update the documentation when creating or modifying features. Test your 194 documentation changes for clarity, concision, and correctness, as well as a 195 clean documentation build. See our contributors guide for [our style 196 guide](https://docs.docker.com/opensource/doc-style) and instructions on [building 197 the documentation](https://docs.docker.com/opensource/project/test-and-docs/#build-and-test-the-documentation). 198 199 Write clean code. Universally formatted code promotes ease of writing, reading, 200 and maintenance. Always run `gofmt -s -w file.go` on each changed file before 201 committing your changes. Most editors have plug-ins that do this automatically. 202 203 Pull request descriptions should be as clear as possible and include a reference 204 to all the issues that they address. 205 206 Commit messages must start with a capitalized and short summary (max. 50 chars) 207 written in the imperative, followed by an optional, more detailed explanatory 208 text which is separated from the summary by an empty line. 209 210 Code review comments may be added to your pull request. Discuss, then make the 211 suggested modifications and push additional commits to your feature branch. Post 212 a comment after pushing. New commits show up in the pull request automatically, 213 but the reviewers are notified only when you comment. 214 215 Pull requests must be cleanly rebased on top of master without multiple branches 216 mixed into the PR. 217 218 **Git tip**: If your PR no longer merges cleanly, use `rebase master` in your 219 feature branch to update your pull request rather than `merge master`. 220 221 Before you make a pull request, squash your commits into logical units of work 222 using `git rebase -i` and `git push -f`. A logical unit of work is a consistent 223 set of patches that should be reviewed together: for example, upgrading the 224 version of a vendored dependency and taking advantage of its now available new 225 feature constitute two separate units of work. Implementing a new function and 226 calling it in another file constitute a single logical unit of work. The very 227 high majority of submissions should have a single commit, so if in doubt: squash 228 down to one. 229 230 After every commit, [make sure the test suite passes] 231 (https://docs.docker.com/opensource/project/test-and-docs/). Include documentation 232 changes in the same pull request so that a revert would remove all traces of 233 the feature or fix. 234 235 Include an issue reference like `Closes #XXXX` or `Fixes #XXXX` in commits that 236 close an issue. Including references automatically closes the issue on a merge. 237 238 Please do not add yourself to the `AUTHORS` file, as it is regenerated regularly 239 from the Git history. 240 241 Please see the [Coding Style](#coding-style) for further guidelines. 242 243 ### Merge approval 244 245 Docker maintainers use LGTM (Looks Good To Me) in comments on the code review to 246 indicate acceptance. 247 248 A change requires LGTMs from an absolute majority of the maintainers of each 249 component affected. For example, if a change affects `docs/` and `registry/`, it 250 needs an absolute majority from the maintainers of `docs/` AND, separately, an 251 absolute majority of the maintainers of `registry/`. 252 253 For more details, see the [MAINTAINERS](MAINTAINERS) page. 254 255 ### Sign your work 256 257 The sign-off is a simple line at the end of the explanation for the patch. Your 258 signature certifies that you wrote the patch or otherwise have the right to pass 259 it on as an open-source patch. The rules are pretty simple: if you can certify 260 the below (from [developercertificate.org](http://developercertificate.org/)): 261 262 ``` 263 Developer Certificate of Origin 264 Version 1.1 265 266 Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 267 660 York Street, Suite 102, 268 San Francisco, CA 94110 USA 269 270 Everyone is permitted to copy and distribute verbatim copies of this 271 license document, but changing it is not allowed. 272 273 Developer's Certificate of Origin 1.1 274 275 By making a contribution to this project, I certify that: 276 277 (a) The contribution was created in whole or in part by me and I 278 have the right to submit it under the open source license 279 indicated in the file; or 280 281 (b) The contribution is based upon previous work that, to the best 282 of my knowledge, is covered under an appropriate open source 283 license and I have the right under that license to submit that 284 work with modifications, whether created in whole or in part 285 by me, under the same open source license (unless I am 286 permitted to submit under a different license), as indicated 287 in the file; or 288 289 (c) The contribution was provided directly to me by some other 290 person who certified (a), (b) or (c) and I have not modified 291 it. 292 293 (d) I understand and agree that this project and the contribution 294 are public and that a record of the contribution (including all 295 personal information I submit with it, including my sign-off) is 296 maintained indefinitely and may be redistributed consistent with 297 this project or the open source license(s) involved. 298 ``` 299 300 Then you just add a line to every git commit message: 301 302 Signed-off-by: Joe Smith <joe.smith@email.com> 303 304 Use your real name (sorry, no pseudonyms or anonymous contributions.) 305 306 If you set your `user.name` and `user.email` git configs, you can sign your 307 commit automatically with `git commit -s`. 308 309 Note that the old-style `Docker-DCO-1.1-Signed-off-by: ...` format is still 310 accepted, so there is no need to update outstanding pull requests to the new 311 format right away, but please do adjust your processes for future contributions. 312 313 ### How can I become a maintainer? 314 315 The procedures for adding new maintainers are explained in the 316 global [MAINTAINERS](https://github.com/docker/opensource/blob/master/MAINTAINERS) 317 file in the [https://github.com/docker/opensource/](https://github.com/docker/opensource/) 318 repository. 319 320 Don't forget: being a maintainer is a time investment. Make sure you 321 will have time to make yourself available. You don't have to be a 322 maintainer to make a difference on the project! 323 324 ## Docker community guidelines 325 326 We want to keep the Docker community awesome, growing and collaborative. We need 327 your help to keep it that way. To help with this we've come up with some general 328 guidelines for the community as a whole: 329 330 * Be nice: Be courteous, respectful and polite to fellow community members: 331 no regional, racial, gender, or other abuse will be tolerated. We like 332 nice people way better than mean ones! 333 334 * Encourage diversity and participation: Make everyone in our community feel 335 welcome, regardless of their background and the extent of their 336 contributions, and do everything possible to encourage participation in 337 our community. 338 339 * Keep it legal: Basically, don't get us in trouble. Share only content that 340 you own, do not share private or sensitive information, and don't break 341 the law. 342 343 * Stay on topic: Make sure that you are posting to the correct channel and 344 avoid off-topic discussions. Remember when you update an issue or respond 345 to an email you are potentially sending to a large number of people. Please 346 consider this before you update. Also remember that nobody likes spam. 347 348 * Don't send email to the maintainers: There's no need to send email to the 349 maintainers to ask them to investigate an issue or to take a look at a 350 pull request. Instead of sending an email, GitHub mentions should be 351 used to ping maintainers to review a pull request, a proposal or an 352 issue. 353 354 ### Guideline violations — 3 strikes method 355 356 The point of this section is not to find opportunities to punish people, but we 357 do need a fair way to deal with people who are making our community suck. 358 359 1. First occurrence: We'll give you a friendly, but public reminder that the 360 behavior is inappropriate according to our guidelines. 361 362 2. Second occurrence: We will send you a private message with a warning that 363 any additional violations will result in removal from the community. 364 365 3. Third occurrence: Depending on the violation, we may need to delete or ban 366 your account. 367 368 **Notes:** 369 370 * Obvious spammers are banned on first occurrence. If we don't do this, we'll 371 have spam all over the place. 372 373 * Violations are forgiven after 6 months of good behavior, and we won't hold a 374 grudge. 375 376 * People who commit minor infractions will get some education, rather than 377 hammering them in the 3 strikes process. 378 379 * The rules apply equally to everyone in the community, no matter how much 380 you've contributed. 381 382 * Extreme violations of a threatening, abusive, destructive or illegal nature 383 will be addressed immediately and are not subject to 3 strikes or forgiveness. 384 385 * Contact abuse@docker.com to report abuse or appeal violations. In the case of 386 appeals, we know that mistakes happen, and we'll work with you to come up with a 387 fair solution if there has been a misunderstanding. 388 389 ## Coding Style 390 391 Unless explicitly stated, we follow all coding guidelines from the Go 392 community. While some of these standards may seem arbitrary, they somehow seem 393 to result in a solid, consistent codebase. 394 395 It is possible that the code base does not currently comply with these 396 guidelines. We are not looking for a massive PR that fixes this, since that 397 goes against the spirit of the guidelines. All new contributions should make a 398 best effort to clean up and make the code base better than they left it. 399 Obviously, apply your best judgement. Remember, the goal here is to make the 400 code base easier for humans to navigate and understand. Always keep that in 401 mind when nudging others to comply. 402 403 The rules: 404 405 1. All code should be formatted with `gofmt -s`. 406 2. All code should pass the default levels of 407 [`golint`](https://github.com/golang/lint). 408 3. All code should follow the guidelines covered in [Effective 409 Go](http://golang.org/doc/effective_go.html) and [Go Code Review 410 Comments](https://github.com/golang/go/wiki/CodeReviewComments). 411 4. Comment the code. Tell us the why, the history and the context. 412 5. Document _all_ declarations and methods, even private ones. Declare 413 expectations, caveats and anything else that may be important. If a type 414 gets exported, having the comments already there will ensure it's ready. 415 6. Variable name length should be proportional to it's context and no longer. 416 `noCommaALongVariableNameLikeThisIsNotMoreClearWhenASimpleCommentWouldDo`. 417 In practice, short methods will have short variable names and globals will 418 have longer names. 419 7. No underscores in package names. If you need a compound name, step back, 420 and re-examine why you need a compound name. If you still think you need a 421 compound name, lose the underscore. 422 8. No utils or helpers packages. If a function is not general enough to 423 warrant it's own package, it has not been written generally enough to be a 424 part of a util package. Just leave it unexported and well-documented. 425 9. All tests should run with `go test` and outside tooling should not be 426 required. No, we don't need another unit testing framework. Assertion 427 packages are acceptable if they provide _real_ incremental value. 428 10. Even though we call these "rules" above, they are actually just 429 guidelines. Since you've read all the rules, you now know that. 430 431 If you are having trouble getting into the mood of idiomatic Go, we recommend 432 reading through [Effective Go](http://golang.org/doc/effective_go.html). The 433 [Go Blog](http://blog.golang.org/) is also a great resource. Drinking the 434 kool-aid is a lot easier than going thirsty.