{"id":13647597,"url":"https://github.com/test-kitchen/kitchen-docker","last_synced_at":"2025-05-13T23:06:35.149Z","repository":{"id":8469474,"uuid":"10068721","full_name":"test-kitchen/kitchen-docker","owner":"test-kitchen","description":"A Test Kitchen Driver for Docker","archived":false,"fork":false,"pushed_at":"2025-03-27T10:47:50.000Z","size":437,"stargazers_count":461,"open_issues_count":54,"forks_count":229,"subscribers_count":35,"default_branch":"main","last_synced_at":"2025-04-10T11:38:42.202Z","etag":null,"topics":["hacktoberfest","managed-by-terraform","ruby","ruby-gem","test-kitchen","testing"],"latest_commit_sha":null,"homepage":"","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/test-kitchen.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2013-05-15T01:40:23.000Z","updated_at":"2025-03-05T16:10:27.000Z","dependencies_parsed_at":"2023-12-04T14:36:04.999Z","dependency_job_id":null,"html_url":"https://github.com/test-kitchen/kitchen-docker","commit_stats":{"total_commits":371,"total_committers":78,"mean_commits":4.756410256410256,"dds":0.6469002695417789,"last_synced_commit":"057465d0559ee74f34139e3799fd9734602ac1d6"},"previous_names":[],"tags_count":50,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/test-kitchen%2Fkitchen-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/test-kitchen%2Fkitchen-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/test-kitchen%2Fkitchen-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/test-kitchen%2Fkitchen-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/test-kitchen","download_url":"https://codeload.github.com/test-kitchen/kitchen-docker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248754433,"owners_count":21156429,"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":["hacktoberfest","managed-by-terraform","ruby","ruby-gem","test-kitchen","testing"],"created_at":"2024-08-02T01:03:40.034Z","updated_at":"2025-04-13T17:39:12.544Z","avatar_url":"https://github.com/test-kitchen.png","language":"Ruby","readme":"# Kitchen-Docker\n\n[![Build Status](https://travis-ci.org/test-kitchen/kitchen-docker.svg?branch=master)](https://travis-ci.org/test-kitchen/kitchen-docker)\n[![Gem Version](https://img.shields.io/gem/v/kitchen-docker.svg)](https://rubygems.org/gems/kitchen-docker)\n[![Coverage](https://img.shields.io/codecov/c/github/test-kitchen/kitchen-docker.svg)](https://codecov.io/github/test-kitchen/kitchen-docker)\n[![License](https://img.shields.io/badge/license-Apache_2-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)\n\nA Test Kitchen Driver and Transport for Docker.\n\n***MAINTAINERS WANTED***: This Test-Kitchen driver is currently without a maintainer and has many known issues. If you're interested in maintaining this driver for the long run including expanding the CI testing please reach out on [Chef Community Slack: #test-kitchen](https://chefcommunity.slack.com/archives/C2B6G1WCQ). Until such a time that this driver is maintained we highly recommend the [kitchen-dokken](https://github.com/test-kitchen/kitchen-dokken) for Chef Infra testing with Docker containers.\n\n## Requirements\n\n* [Docker][docker_installation] **(\u003e= 1.5)**\n\n## Installation and Setup\n\nPlease read the Test Kitchen [docs][test_kitchen_docs] for more details.\n\nExample (Linux) `.kitchen.local.yml`:\n\n```yaml\n---\ndriver:\n  name: docker\n  env_variables:\n    TEST_KEY: TEST_VALUE\n\nplatforms:\n- name: ubuntu\n  run_list:\n  - recipe[apt]\n- name: centos\n  driver_config:\n    image: centos\n    platform: rhel\n  run_list:\n  - recipe[yum]\n\ntransport:\n  name: docker\n```\n\nExample (Windows) `.kitchen.local.yml`:\n\n```yaml\n---\ndriver:\n  name: docker\n\nplatforms:\n- name: windows\n  driver_config:\n    image: mcr.microsoft.com/windows/servercore:1607\n    platform: windows\n  run_list:\n  - recipe[chef_client]\n\ntransport:\n  name: docker\n  env_variables:\n    TEST_KEY: TEST_VALUE\n```\n\n## Default Configuration\n\nThis driver can determine an image and platform type for a select number of\nplatforms.\n\nExamples:\n\n```yaml\n---\nplatforms:\n- name: ubuntu-18.04\n- name: centos-7\n```\n\nThis will effectively generate a configuration similar to:\n\n```yaml\n---\nplatforms:\n- name: ubuntu-18.04\n  driver_config:\n    image: ubuntu:18.04\n    platform: ubuntu\n- name: centos-7\n  driver_config:\n    image: centos:7\n    platform: centos\n```\n\n## Configuration\n\n### binary\n\nThe Docker binary to use.\n\nThe default value is `docker`.\n\nExamples:\n\n```yaml\n  binary: docker.io\n```\n\n```yaml\n  binary: /opt/docker\n```\n\n### socket\n\nThe Docker daemon socket to use. By default, Docker will listen on `unix:///var/run/docker.sock` (On Windows, `npipe:////./pipe/docker_engine`),\nand no configuration here is required. If Docker is binding to another host/port or Unix socket, you will need to set this option.\nIf a TCP socket is set, its host will be used for SSH access to suite containers.\n\nExamples:\n\n```yaml\n  socket: unix:///tmp/docker.sock\n```\n\n```yaml\n  socket: tcp://docker.example.com:4242\n```\n\nIf you are using the InSpec verifier on Windows, using named pipes for the Docker engine will not work with the Docker transport.\nSet the socket option with the TCP socket address of the Docker engine as shown below:\n\n```yaml\nsocket: tcp://localhost:2375\n```\n\nThe Docker engine must be configured to listen on a TCP port (default port is 2375). This can be configured by editing the configuration file\n(usually located in `C:\\ProgramData\\docker\\config\\daemon.json`) and adding the hosts value:\n\n```json\n\"hosts\": [\"tcp://0.0.0.0:2375\"]\n```\n\nExample configuration is shown below:\n\n```json\n{\n  \"registry-mirrors\": [],\n  \"insecure-registries\": [],\n  \"debug\": true,\n  \"experimental\": false,\n  \"hosts\": [\"tcp://0.0.0.0:2375\"]\n}\n```\n\nIf you use [Boot2Docker](https://github.com/boot2docker/boot2docker)\nor [docker-machine](https://docs.docker.com/machine/get-started/) set\nyour `DOCKER_HOST` environment variable properly with `export\nDOCKER_HOST=tcp://192.168.59.103:2375` or `eval \"$(docker-machine env\n$MACHINE)\"` then use the following:\n\n```yaml\nsocket: tcp://192.168.59.103:2375\n```\n\n### image\n\nThe Docker image to use as the base for the suite containers. You can find\nimages using the [Docker Index][docker_index].\n\nThe default will be computed, using the platform name (see the Default\nConfiguration section for more details).\n\n### isolation\n\nThe isolation technology for the container. This is not set by default and will use the default container isolation settings.\n\nFor example, the following driver configuration options can be used to specify the container isolation technology for Windows containers:\n\n```yaml\n# Hyper-V\nisolation: hyperv\n\n# Process\nisolation: process\n```\n\n### platform\n\nThe platform of the chosen image. This is used to properly bootstrap the\nsuite container for Test Kitchen. Kitchen Docker currently supports:\n\n* `arch`\n* `debian` or `ubuntu`\n* `amazonlinux`, `rhel`, `centos`, `fedora`, `oraclelinux`, `almalinux` or `rockylinux`\n* `gentoo` or `gentoo-paludis`\n* `opensuse/tumbleweed`, `opensuse/leap`, `opensuse` or `sles`\n* `windows`\n\nThe default will be computed, using the platform name (see the Default\nConfiguration section for more details).\n\n### require\\_chef\\_omnibus\n\nDetermines whether or not a Chef [Omnibus package][chef_omnibus_dl] will be\ninstalled. There are several different behaviors available:\n\n* `true` - the latest release will be installed. Subsequent converges\n  will skip re-installing if chef is present.\n* `latest` - the latest release will be installed. Subsequent converges\n  will always re-install even if chef is present.\n* `\u003cVERSION_STRING\u003e` (ex: `10.24.0`) - the desired version string will\n  be passed the the install.sh script. Subsequent converges will skip if\n  the installed version and the desired version match.\n* `false` or `nil` - no chef is installed.\n\nThe default value is `true`.\n\n### disable\\_upstart\n\nDisables upstart on Debian/Ubuntu containers, as many images do not support a\nworking upstart.\n\nThe default value is `true`.\n\n### provision\\_command\n\nCustom command(s) to be run when provisioning the base for the suite containers.\n\nExamples:\n\n```yaml\n  provision_command: curl -L https://www.opscode.com/chef/install.sh | bash\n```\n\n```yaml\n  provision_command:\n    - apt-get install dnsutils\n    - apt-get install telnet\n```\n\n```yaml\ndriver_config:\n  provision_command: curl -L https://www.opscode.com/chef/install.sh | bash\n  require_chef_omnibus: false\n```\n\n### env_variables\n\nAdds environment variables to Docker container\n\nExamples:\n\n```yaml\n  env_variables:\n    TEST_KEY_1: TEST_VALUE\n    SOME_VAR: SOME_VALUE\n```\n\n### use\\_cache\n\nThis determines if the Docker cache is used when provisioning the base for suite\ncontainers.\n\nThe default value is `true`.\n\n### use\\_sudo\n\nThis determines if Docker commands are run with `sudo`.\n\nThe default value depends on the type of socket being used. For local sockets, the default value is `true`. For remote sockets, the default value is `false`.\n\nThis should be set to `false` if you're using boot2docker, as every command passed into the VM runs as root by default.\n\n### remove\\_images\n\nThis determines if images are automatically removed when the suite container is\ndestroyed.\n\nThe default value is `false`.\n\n### run\\_command\n\nSets the command used to run the suite container.\n\nThe default value is `/usr/sbin/sshd -D -o UseDNS=no -o UsePAM=no -o PasswordAuthentication=yes -o UsePrivilegeSeparation=no -o PidFile=/tmp/sshd.pid`.\n\nExamples:\n\n```yaml\n  run_command: /sbin/init\n```\n\n### memory\n\nSets the memory limit for the suite container in bytes. Otherwise use Dockers\ndefault. You can read more about `memory.limit_in_bytes` [here][memory_limit].\n\n### cpu\n\nSets the CPU shares (relative weight) for the suite container. Otherwise use\nDockers defaults. You can read more about cpu.shares [here][cpu_shares].\n\n### volume\n\nAdds a data volume(s) to the suite container.\n\nExamples:\n\n```yaml\n  volume: /ftp\n```\n\n```yaml\n  volume:\n  - /ftp\n  - /srv\n```\n\n### volumes\\_from\n\nMount volumes managed by other containers.\n\nExamples:\n\n```yaml\n  volumes_from: repos\n```\n\n```yaml\n  volumes_from:\n  - repos\n  - logging\n  - rvm\n```\n\n### mount\n\nAttach a filesystem mount to the container (**NOTE:** supported only in docker\n17.05 and newer).\n\nExamples:\n\n```yaml\n  mount: type=volume,source=my-volume,destination=/path/in/container\n```\n\n```yaml\n  mount:\n  - type=volume,source=my-volume,destination=/path/in/container\n  - type=tmpfs,tmpfs-size=512M,destination=/path/to/tmpdir\n```\n\n### tmpfs\n\nAdds a tmpfs volume(s) to the suite container.\n\nExamples:\n\n```yaml\n  tmpfs: /tmp\n```\n\n```yaml\n  tmpfs:\n  - /tmp:exec\n  - /run\n```\n\n### dns\n\nAdjusts `resolv.conf` to use the dns servers specified. Otherwise use\nDockers defaults.\n\nExamples:\n\n```yaml\n  dns: 8.8.8.8\n```\n\n```yaml\n  dns:\n  - 8.8.8.8\n  - 8.8.4.4\n```\n\n### http\\_proxy\n\nSets an http proxy for the suite container using the `http_proxy` environment variable.\n\nExamples:\n\n```yaml\n  http_proxy: http://proxy.host.com:8080\n```\n\n### https\\_proxy\n\nSets an https proxy for the suite container using the `https_proxy` environment variable.\n\nExamples:\n\n```yaml\n  https_proxy: http://proxy.host.com:8080\n```\n\n### forward\n\nSet suite container port(s) to forward to the host machine. You may specify\nthe host (public) port in the mappings, if not, Docker chooses for you.\n\nExamples:\n\n```yaml\n  forward: 80\n```\n\n```yaml\n  forward:\n  - 22:2222\n  - 80:8080\n```\n\n### hostname\n\nSet the suite container hostname. Otherwise use Dockers default.\n\nExamples:\n\n```yaml\n  hostname: foobar.local\n```\n\n### privileged\n\nRun the suite container in privileged mode. This allows certain functionality\ninside the Docker container which is not otherwise permitted.\n\nThe default value is `false`.\n\nExamples:\n\n```yaml\n  privileged: true\n```\n\n### cap\\_add\n\nAdds a capability to the running container.\n\nExamples:\n\n```yaml\ncap_add:\n- SYS_PTRACE\n\n```\n\n### cap\\_drop\n\nDrops a capability from the running container.\n\nExamples:\n\n```yaml\ncap_drop:\n- CHOWN\n```\n\n### security\\_opt\n\nApply a security profile to the Docker container. Allowing finer granularity of\naccess control than privileged mode, through leveraging SELinux/AppArmor\nprofiles to grant access to specific resources.\n\nExamples:\n\n```yaml\nsecurity_opt:\n  - apparmor:my_profile\n```\n\n### dockerfile\n\nUse a custom Dockerfile, instead of having Kitchen-Docker build one for you.\n\nExamples:\n\n```yaml\n  dockerfile: test/Dockerfile\n```\n\n### instance\\_name\n\nSet the name of container to link to other container(s).\n\nExamples:\n\n```yaml\n  instance_name: web\n```\n\n### links\n\nSet ```instance_name```(and alias) of other container(s) that connect from the suite container.\n\nExamples:\n\n```yaml\n links: db:db\n```\n\n```yaml\n  links:\n  - db:db\n  - kvs:kvs\n```\n\n### publish\\_all\n\nPublish all exposed ports to the host interfaces.\nThis option used to communicate between some containers.\n\nThe default value is `false`.\n\nExamples:\n\n```yaml\n  publish_all: true\n```\n\n### devices\n\nShare a host device with the container. Host device must be an absolute path.\n\nExamples:\n\n```yaml\ndevices: /dev/vboxdrv\n```\n\n```yaml\ndevices:\n  - /dev/vboxdrv\n  - /dev/vboxnetctl\n```\n\n### build_context\n\nTransfer the cookbook directory (cwd) as build context. This is required for\nDockerfile commands like ADD and COPY. When using a remote Docker server, the\nwhole directory has to be copied, which can be slow.\n\nThe default value is `true` for local Docker and `false` for remote Docker.\n\nExamples:\n\n```yaml\n  build_context: true\n```\n\n### build_options\n\nExtra command-line options to pass to `docker build` when creating the image.\n\nExamples:\n\n```yaml\n  build_options: --rm=false\n```\n\n```yaml\n  build_options:\n    rm: false\n    build-arg: something\n```\n\n### run_options\n\nExtra command-line options to pass to `docker run` when starting the container.\n\nExamples:\n\n```yaml\n  run_options: --ip=1.2.3.4\n```\n\n```yaml\n  run_options:\n    tmpfs:\n    - /run/lock\n    - /tmp\n    net: br3\n```\n\n### build_tempdir\n\nRelative (to `build_context`) temporary directory path for built Dockerfile.\n\nExample:\n\n```yaml\n  build_tempdir: .kitchen\n```\n\n### use_internal_docker_network\n\nIf you want to use kitchen-docker from within another Docker container you'll\nneed to set this to true. When set to true uses port 22 as the SSH port and\nthe IP of the container that chef is going to run in as the hostname so that\nyou can connect to it over SSH from within another Docker container.\n\nExamples:\n\n```yaml\n  use_internal_docker_network: true\n```\n\n### docker_platform\n\nConfigure the CPU platform (architecture) used by docker to build the image.\n\nExamples:\n\n```yaml\n  docker_platform: linux/arm64\n```\n\n```yaml\n  docker_platform: linux/amd64\n```\n\n## Development\n\n* Source hosted at [GitHub][repo]\n* Report issues/questions/feature requests on [GitHub Issues][issues]\n\nPull requests are very welcome! Make sure your patches are well tested.\nIdeally create a topic branch for every separate change you make. For\nexample:\n\n1. Fork the repo\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Added some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n## License\n\n```text\nCopyright 2013-2016, [Sean Porter](https://github.com/portertech)\nCopyright 2015-2016, [Noah Kantrowitz](https://github.com/coderanger)\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n\n[issues]:                 https://github.com/test-kitchen/kitchen-docker/issues\n[repo]:                   https://github.com/test-kitchen/kitchen-docker\n[docker_installation]:    https://docs.docker.com/installation/#installation\n[docker_index]:           https://index.docker.io/\n[test_kitchen_docs]:      https://kitchen.ci/docs/getting-started/introduction/\n[chef_omnibus_dl]:        https://downloads.chef.io/chef-client/\n[cpu_shares]:             https://docs.fedoraproject.org/en-US/Fedora/17/html/Resource_Management_Guide/sec-cpu.html\n[memory_limit]:           https://docs.fedoraproject.org/en-US/Fedora/17/html/Resource_Management_Guide/sec-memory.html\n","funding_links":[],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftest-kitchen%2Fkitchen-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftest-kitchen%2Fkitchen-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftest-kitchen%2Fkitchen-docker/lists"}