{"id":13476313,"url":"https://github.com/sous-chefs/docker","last_synced_at":"2025-05-14T03:06:37.588Z","repository":{"id":8408994,"uuid":"9992805","full_name":"sous-chefs/docker","owner":"sous-chefs","description":"Development repository for the docker cookbook","archived":false,"fork":false,"pushed_at":"2025-04-24T01:02:32.000Z","size":5198,"stargazers_count":1366,"open_issues_count":9,"forks_count":791,"subscribers_count":104,"default_branch":"main","last_synced_at":"2025-05-07T15:31:01.946Z","etag":null,"topics":["chef","chef-cookbook","chef-resource","docker","hacktoberfest","managed-by-terraform"],"latest_commit_sha":null,"homepage":"https://supermarket.chef.io/cookbooks/docker","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sous-chefs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG-pre4.0.0.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"open_collective":"sous-chefs"}},"created_at":"2013-05-11T00:21:06.000Z","updated_at":"2025-05-07T02:10:09.000Z","dependencies_parsed_at":"2024-11-09T22:24:39.560Z","dependency_job_id":"be1d83e5-bf37-4866-9956-c52f381b947a","html_url":"https://github.com/sous-chefs/docker","commit_stats":{"total_commits":2424,"total_committers":221,"mean_commits":"10.968325791855204","dds":0.7995049504950495,"last_synced_commit":"06896ca86ece40d26aff3fec76b0f3b3179140c4"},"previous_names":[],"tags_count":438,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sous-chefs%2Fdocker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sous-chefs%2Fdocker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sous-chefs%2Fdocker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sous-chefs%2Fdocker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sous-chefs","download_url":"https://codeload.github.com/sous-chefs/docker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253657338,"owners_count":21943271,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chef","chef-cookbook","chef-resource","docker","hacktoberfest","managed-by-terraform"],"created_at":"2024-07-31T16:01:28.847Z","updated_at":"2025-05-14T03:06:37.541Z","avatar_url":"https://github.com/sous-chefs.png","language":"Ruby","funding_links":["https://opencollective.com/sous-chefs"],"categories":["Ruby"],"sub_categories":[],"readme":"# Docker Cookbook\n\n[![CI State](https://github.com/sous-chefs/docker/workflows/ci/badge.svg)](https://github.com/sous-chefs/docker/actions?query=workflow%3Aci)\n[![OpenCollective](https://opencollective.com/sous-chefs/backers/badge.svg)](#backers)\n[![OpenCollective](https://opencollective.com/sous-chefs/sponsors/badge.svg)](#sponsors)\n[![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0)\n\nThe Docker Cookbook provides resources for installing docker as well as building, managing, and running docker containers.\n\n## Scope\n\nThis cookbook is concerned with the [Docker](http://docker.io) container engine as distributed by Docker, Inc. It does not address Docker ecosystem tooling or prerequisite technology such as cgroups or aufs.\n\n## Maintainers\n\nThis cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit [sous-chefs.org](https://sous-chefs.org/) or come chat with us on the Chef Community Slack in [#sous-chefs](https://chefcommunity.slack.com/messages/C2V7B88SF).\n\n## Requirements\n\n- Network accessible web server hosting the docker binary.\n- SELinux permissive/disabled if CentOS [Docker Issue #15498](https://github.com/docker/docker/issues/15498)\n\n## Platform Support\n\n- Amazon Linux 2\n- Debian 9/10/11\n- Fedora\n- Ubuntu 18.04/20.04/22.04\n- CentOS 7/8\n\n## Cookbook Dependencies\n\nThis cookbook automatically sets up the upstream Docker package repositories. If you would like to use your own repositories this functionality can be disabled and you can instead setup the repos yourself with yum_repository/apt_repository resources or the [chef-apt-docker](https://supermarket.chef.io/cookbooks/chef-apt-docker) / [chef-yum-docker](https://supermarket.chef.io/cookbooks/chef-yum-docker) cookbooks.\n\n## Docker Group\n\nIf you are not using the official docker repositories you may run into issues with the docker group being different. RHEL is a known issue that defaults to using `dockerroot` for the service group. Add the `group` property to the `docker_service`.\n\n```ruby\ndocker_service 'default' do\n  group 'dockerroot'\n  action [:create, :start]\nend\n```\n\n## Usage\n\n- Add `depends 'docker'` to your cookbook's metadata.rb\n- Use the resources shipped in cookbook in a recipe, the same way you'd use core Chef resources (file, template, directory, package, etc).\n\n```ruby\ndocker_service 'default' do\n  action [:create, :start]\nend\n\ndocker_image 'busybox' do\n  action :pull\nend\n\ndocker_container 'an-echo-server' do\n  repo 'busybox'\n  port '1234:1234'\n  command \"nc -ll -p 1234 -e /bin/cat\"\nend\n```\n\n## Test Cookbooks as Examples\n\nThe cookbooks run by test-kitchen make excellent usage examples.\n\nThose recipes are found at `test/cookbooks/docker_test`.\n\n## Resources Overview\n\n- [docker_service](documentation/docker_service.md): composite resource that uses docker_installation and docker_service_manager\n- [docker_container](documentation/docker_container.md): container operations\n- [docker_exec](documentation/docker_exec.md): execute commands inside running containers\n- [docker_image](documentation/docker_image.md): image/repository operations\n- [docker_image_prune](documentation/docker_image_prune.md): remove unused docker images\n- [docker_installation_package](documentation/docker_installation_package.md): install Docker via package 'docker-ce'\n- [docker_installation_script](documentation/docker_installation_script.md): install Docker via curl | bash\n- [docker_installation_tarball](documentation/docker_installation_tarball.md): install Docker from a tarball\n- [docker_network](documentation/docker_network.md): network operations\n- [docker_plugin](documentation/docker_plugin.md): plugin operations\n- [docker_registry](documentation/docker_registry.md): registry operations\n- [docker_service_manager_execute](documentation/docker_service_manager_execute.md): manage docker daemon with Chef\n- [docker_service_manager_systemd](documentation/docker_service_manager_systemd.md): manage docker daemon with systemd unit files\n- [docker_tag](documentation/docker_tag.md): image tagging operations\n- [docker_volume](documentation/docker_volume.md): volume operations\n- [docker_volume_prune](documentation/docker_volume_prune.md): remove unused docker volumes\n- [docker_swarm_init](documentation/docker_swarm_init.md): initialize a new Docker swarm cluster\n- [docker_swarm_join](documentation/docker_swarm_join.md): join a node to a Docker swarm cluster\n- [docker_swarm_service](documentation/docker_swarm_service.md): manage Docker swarm services\n- [docker_swarm_token](documentation/docker_swarm_token.md): manage Docker swarm tokens\n\n## Getting Started\n\nHere's a quick example of pulling the latest image and running a container with exposed ports.\n\n```ruby\n# Pull latest image\ndocker_image 'nginx' do\n  tag 'latest'\n  action :pull\n  notifies :redeploy, 'docker_container[my_nginx]'\nend\n\n# Run container mapping containers port 80 to the host's port 80\ndocker_container 'my_nginx' do\n  repo 'nginx'\n  tag 'latest'\n  port [ '80:80' ]\n  host_name 'www'\n  domain_name 'computers.biz'\n  env 'FOO=bar'\n  volumes [ '/some/local/files/:/etc/nginx/conf.d' ]\nend\n```\n\nYou might run a private registry and multiple Docker hosts.\n\n```ruby\n# Login to private registry\ndocker_registry 'https://registry.computers.biz/' do\n  username 'shipper'\n  password 'iloveshipping'\n  email 'shipper@computers.biz'\nend\n\n# Pull tagged image\ndocker_image 'registry.computers.biz:443/my_project/my_container' do\n  tag 'latest'\n  action :pull\n  host 'tcp://host-1.computers.biz:2376'\nend\n\n# Run container\ndocker_container 'crowsnest' do\n  repo 'registry.computers.biz:443/my_project/my_container'\n  tag 'latest'\n  host 'tcp://host-2.computers.biz:2376'\n  tls_verify true\n  tls_ca_cert \"/path/to/ca.pem\"\n  tls_client_cert \"/path/to/cert.pem\"\n  tls_client_key \"/path/to/key.pem\"\n  action :run\nend\n```\n\nYou can manipulate Docker volumes and networks\n\n```ruby\ndocker_network 'my_network' do\n  subnet '10.9.8.0/24'\n  gateway '10.9.8.1'\nend\n\ndocker_volume 'my_volume' do\n  action :create\nend\n\ndocker_container 'my_container' do\n  repo 'alpine'\n  tag '3.1'\n  command \"nc -ll -p 1234 -e /bin/cat\"\n  volumes 'my_volume:/my_data'\n  network_mode 'my_network'\n  action :run\nend\n```\n\nSee full documentation for each resource and action below for more information.\n\n## Resources\n\n## docker_installation\n\nThe `docker_installation` resource auto-selects one of the below resources with the provider resolution system.\n\n### Example\n\n```ruby\ndocker_installation 'default'\n```\n\n## docker_installation_tarball\n\nThe `docker_installation_tarball` resource copies the precompiled Go binary tarball onto the disk. It should not be used in production, especially with devicemapper.\n\n### Example\n\n```ruby\ndocker_installation_tarball 'default' do\n  version '1.11.0'\n  source 'https://my.computers.biz/dist/docker.tgz'\n  checksum '97a3f5924b0b831a310efa8bf0a4c91956cd6387c4a8667d27e2b2dd3da67e4d'\n  action :create\nend\n```\n\n### Properties\n\n- `version` - The desired version of docker to fetch.\n- `channel` - The docker channel to fetch the tarball from. Default: stable\n- `source` - Path to network accessible Docker binary tarball. Ignores version when set.\n- `checksum` - SHA-256 checksum of the tarball file.\n\n## docker_installation_script\n\nThe `docker_installation_script` resource runs the script hosted by Docker, Inc at \u003chttp://get.docker.com\u003e. It configures package repositories and installs a dynamically compiled binary.\n\n### Example\n\n```ruby\ndocker_installation_script 'default' do\n  repo 'main'\n  script_url 'https://my.computers.biz/dist/scripts/docker.sh'\n  action :create\nend\n```\n\n### Properties\n\n- `repo` - One of 'main', 'test', or 'experimental'. Used to calculate script_url in its absence. Defaults to 'main'\n- `script_url` - 'URL of script to pipe into /bin/sh as root.\n\n## docker_installation_package\n\nThe `docker_installation_package` resource uses the system package manager to install Docker. It relies on the pre-configuration of the system's package repositories. The `chef-yum-docker` and `chef-apt-docker` Supermarket cookbooks can be used to use Docker's own repositories.\n\n**_This is the recommended production installation method._**\n\n### Example\n\n```ruby\ndocker_installation_package 'default' do\n  version '20.10.11'\n  action :create\n  package_options %q|--force-yes -o Dpkg::Options::='--force-confold' -o Dpkg::Options::='--force-all'| # if Ubuntu for example\nend\n```\n\n### Properties\n\n- `version` - Used to calculate package_version string. This needs to be the complete version (19.03.8).\n- `package_version` - Manually specify the package version string\n- `package_name` - Name of package to install. Defaults to 'docker-ce'\n- `package_options` - Manually specify additional options, like apt-get directives for example\n- `setup_docker_repo` - Setup the download.docker.com repo. If you would like to manage the repo yourself so you can use an internal repo then set this to false. default: true on all platforms except Amazon Linux.\n- `repo_channel` - The channel of docker to setup from download.docker.com. Only used if `setup_docker_repo` is true. default: 'stable'\n\n## docker_service_manager\n\nThe `docker_service_manager` resource auto-selects a strategy from the `docker_service_manager_*` group of resources based on platform and version. The `docker_service` family share a common set of properties.\n\n### Example\n\n```ruby\ndocker_service_manager 'default' do\n  action :start\nend\n```\n\n## docker_service_manager_execute\n\n### Example\n\n```ruby\ndocker_service_manager_execute 'default' do\n  action :start\nend\n```\n\n## docker_service_manager_systemd\n\n### Example\n\n```ruby\ndocker_service_manager_systemd 'default' do\n  host ['unix:///var/run/docker.sock', 'tcp://127.0.0.1:2376']\n  tls_verify true\n  tls_ca_cert \"/path/to/ca.pem\"\n  tls_server_cert \"/path/to/server.pem\"\n  tls_server_key \"/path/to/server-key.pem\"\n  tls_client_cert \"/path/to/cert.pem\"\n  tls_client_key \"/path/to/key.pem\"\n  systemd_opts [\"TasksMax=infinity\",\"MountFlags=private\"]\n  systemd_socket_opts [\"Accept=yes\"]\n  action :start\nend\n```\n\n## Contributors\n\nThis project exists thanks to all the people who [contribute.](https://opencollective.com/sous-chefs/contributors.svg?width=890\u0026button=false)\n\n### Backers\n\nThank you to all our backers!\n\n![https://opencollective.com/sous-chefs#backers](https://opencollective.com/sous-chefs/backers.svg?width=600\u0026avatarHeight=40)\n\n### Sponsors\n\nSupport this project by becoming a sponsor. Your logo will show up here with a link to your website.\n\n![https://opencollective.com/sous-chefs/sponsor/0/website](https://opencollective.com/sous-chefs/sponsor/0/avatar.svg?avatarHeight=100)\n![https://opencollective.com/sous-chefs/sponsor/1/website](https://opencollective.com/sous-chefs/sponsor/1/avatar.svg?avatarHeight=100)\n![https://opencollective.com/sous-chefs/sponsor/2/website](https://opencollective.com/sous-chefs/sponsor/2/avatar.svg?avatarHeight=100)\n![https://opencollective.com/sous-chefs/sponsor/3/website](https://opencollective.com/sous-chefs/sponsor/3/avatar.svg?avatarHeight=100)\n![https://opencollective.com/sous-chefs/sponsor/4/website](https://opencollective.com/sous-chefs/sponsor/4/avatar.svg?avatarHeight=100)\n![https://opencollective.com/sous-chefs/sponsor/5/website](https://opencollective.com/sous-chefs/sponsor/5/avatar.svg?avatarHeight=100)\n![https://opencollective.com/sous-chefs/sponsor/6/website](https://opencollective.com/sous-chefs/sponsor/6/avatar.svg?avatarHeight=100)\n![https://opencollective.com/sous-chefs/sponsor/7/website](https://opencollective.com/sous-chefs/sponsor/7/avatar.svg?avatarHeight=100)\n![https://opencollective.com/sous-chefs/sponsor/8/website](https://opencollective.com/sous-chefs/sponsor/8/avatar.svg?avatarHeight=100)\n![https://opencollective.com/sous-chefs/sponsor/9/website](https://opencollective.com/sous-chefs/sponsor/9/avatar.svg?avatarHeight=100)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsous-chefs%2Fdocker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsous-chefs%2Fdocker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsous-chefs%2Fdocker/lists"}