{"id":15048323,"url":"https://github.com/github/garethr-docker","last_synced_at":"2025-10-04T10:30:42.321Z","repository":{"id":16022554,"uuid":"18766203","full_name":"github/garethr-docker","owner":"github","description":"Puppet module for managing docker","archived":true,"fork":true,"pushed_at":"2014-06-19T22:59:24.000Z","size":371,"stargazers_count":7,"open_issues_count":0,"forks_count":11,"subscribers_count":27,"default_branch":"master","last_synced_at":"2024-09-30T00:41:29.301Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"garethr/garethr-docker","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/github.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-14T15:39:11.000Z","updated_at":"2024-07-31T03:22:34.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/github/garethr-docker","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fgarethr-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fgarethr-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fgarethr-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fgarethr-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/github","download_url":"https://codeload.github.com/github/garethr-docker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235238012,"owners_count":18958031,"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":[],"created_at":"2024-09-24T21:10:47.086Z","updated_at":"2025-10-04T10:30:41.907Z","avatar_url":"https://github.com/github.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"Puppet module for installing\n[Docker](https://github.com/dotcloud/docker) from the [official repository](http://docs.docker.io/en/latest/installation/ubuntulinux/) on Ubuntu or from [EPEL on RedHat](http://docs.docker.io/en/latest/installation/rhel/) based distributions.\n\nThis module is also available on the [Puppet\nForge](https://forge.puppetlabs.com/garethr/docker)\n\n[![Build\nStatus](https://secure.travis-ci.org/garethr/garethr-docker.png)](http://travis-ci.org/garethr/garethr-docker)\n\n## Usage\n\nThe module includes a single class:\n\n```puppet\ninclude 'docker'\n```\n\nBy default this sets up the docker hosted Apt repository and installs\nthe lxc-docker package and the required Kernel.\n\nIf you don't want this module to mess about with your Kernel then you\ncan disable this feature like so:\n\n```puppet\nclass { 'docker':\n  manage_kernel =\u003e false,\n}\n```\n\nIf you want to configure your package sources independently,\ninform this module to not auto-include upstream sources:\n\n```puppet\nclass { 'docker':\n  use_upstream_package_source =\u003e false,\n}\n```\n\nBy default the docker daemon will bind to a unix socket at\n/var/run/docker.sock. This can be changed, as well as binding to a tcp\nsocket if required.\n\n```puppet\nclass { 'docker':\n  tcp_bind    =\u003e 'tcp://127.0.0.1:4243',\n  socket_bind =\u003e 'unix:///var/run/docker.sock',\n}\n```\n\nUnless specified this installs the latest version of docker from the\nlxc-docker package. However if you want to specify a specific version\nyou can do so:\n\n```puppet\nclass { 'docker':\n  version =\u003e '0.5.5',\n}\n```\n\nIn some cases dns resolution won't work well in the container unless you give a dns server to the docker daemon like this:\n\n```puppet\nclass { 'docker':\n  dns =\u003e '8.8.8.8',\n}\n```\n\n### Images\n\nThe next step is probably to install a docker image, for this we have a defined type which can be used like so:\n\n```puppet\ndocker::image { 'base': }\n```\n\nThis is equivalent to running `docker pull base`. This is downloading a large binary so on first run can take a while. For that reason this define turns off the default 5 minute timeout for exec. Takes an optional parameter for installing image tags that is the equivalent to running `docker pull -t=\"precise\" ubuntu`:  \n\n```puppet\ndocker::image { 'ubuntu':\n  image_tag =\u003e 'precise'\n}\n```\n\nNote: images will only install if an image of that name does not already exist.  \n\nYou can also remove images you no longer need with:  \n\n```puppet\ndocker::image { 'base':\n  ensure =\u003e 'absent'\n}\n\ndocker::image { 'ubuntu':\n  ensure    =\u003e 'absent',\n  image_tag =\u003e 'precise'\n}\n```\n\n### Containers\n\nNow you have an image you can run commands within a container managed by docker.\n\n```puppet\ndocker::run { 'helloworld':\n  image   =\u003e 'base',\n  command =\u003e '/bin/sh -c \"while true; do echo hello world; sleep 1; done\"',\n}\n```\n\nThis is equivalent to running the following under upstart:\n\n    docker run -d base /bin/sh -c \"while true; do echo hello world; sleep 1; done\"\n\nRun also contains a number of optional parameters:\n\n```puppet\ndocker::run { 'helloworld':\n  image           =\u003e 'base',\n  command         =\u003e '/bin/sh -c \"while true; do echo hello world; sleep 1; done\"',\n  ports           =\u003e ['4444', '4555'],\n  links           =\u003e ['mysql:db'],\n  use_name        =\u003e true,\n  volumes         =\u003e ['/var/lib/couchdb', '/var/log'],\n  volumes_from    =\u003e '6446ea52fbc9',\n  memory_limit    =\u003e 10485760, # bytes \n  username        =\u003e 'example',\n  hostname        =\u003e 'example.com',\n  env             =\u003e ['FOO=BAR', 'FOO2=BAR2'],\n  dns             =\u003e ['8.8.8.8', '8.8.4.4'],\n  restart_service =\u003e true,\n}\n```\n\nPorts, env, dns and volumes can be set with either a single string or as above with an array of values.\n\nTo use an image tag just append the tag name to the image name separated by a semicolon:\n\n```puppet\ndocker::run { 'helloworld':\n  image   =\u003e 'ubuntu:precise',\n  command =\u003e '/bin/sh -c \"while true; do echo hello world; sleep 1; done\"',\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub%2Fgarethr-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgithub%2Fgarethr-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub%2Fgarethr-docker/lists"}