puppet_docker_tools

Utilities for building and publishing the docker images at hub.docker.com/u/puppet

Usage

Getting Started

puppet_docker_tools is packaged as a gem, so to get started either gem install puppet_docker_tools or add gem 'puppet_docker_tools' to your Gemfile.

You also need to have docker installed and running. See these docs for more information on getting docker set up.

$ puppet-docker help
Usage:
  puppet-docker build [DIRECTORY] [--dockerfile=<dockerfile>] [--repository=<repo>] [--namespace=<namespace>] [--no-cache]
  puppet-docker lint [DIRECTORY] [--dockerfile=<dockerfile>]
  puppet-docker pull [IMAGE] [--repository=<repo>]
  puppet-docker push [DIRECTORY] [--dockerfile=<dockerfile>] [--repository=<repo>] [--namespace=<namespace>]
  puppet-docker rev-labels [DIRECTORY] [--dockerfile=<dockerfile>] [--namespace=<namespace>]
  puppet-docker spec [DIRECTORY]
  puppet-docker test [DIRECTORY] [--dockerfile=<dockerfile>]
  puppet-docker version [DIRECTORY] [--dockerfile=<dockerfile>] [--namespace=<namespace>]
  puppet-docker update-base-images [TAG]...
  puppet-docker help

Arguments:
  DIRECTORY  Directory containing the Dockerfile for the image you're operating on. Defaults to $PWD
  IMAGE      The docker image to operate on, including namespace. Defaults to '<repo>/puppet_docker_tools'
  TAG        Pull latest versions of images at TAG. Defaults to ['ubuntu:16.04', 'centos:7', 'alpine:3.4', 'debian:9', 'postgres:9.6.8']

Options:
  --repository=<repo>        Dockerhub repository containing the image [default: puppet]
  --no-cache                 Disable use of layer cache when building this image. Defaults to using the cache.
  --namespace=<namespace>    Namespace for labels on the container [default: org.label-schema]
  --dockerfile=<dockerfile>  File name for your dockerfile [default: Dockerfile]

puppet-docker build

Build a docker image based on the dockerfile in DIRECTORY.

puppet-docker lint

Run hadolint on the dockerfile in DIRECTORY. The lint task runs on the hadolint/hadolint container with the following rule exclusions:

  • DL3008 - Pin versions in apt get install
  • DL4000 - MAINTAINER is deprecated
  • DL4001 - Don't use both wget and curl

puppet-docker pull

Pull the specified image, i.e. 'puppet/puppetserver'. NOTE: If you don't include the tag you want to pull, puppet-docker pull will pull all tags for that image.

puppet-docker push

Push images built from the dockerfile in DIRECTORY to hub.docker.com. This task will fail if you do not have a version specified in your dockerfile. It will push both a versioned and a 'latest' tagged image.

puppet-docker rev-labels

Update vcs-ref and build-date labels in your dockerfile to current git sha and current UTC time.

puppet-docker spec

Run the rspec tests under DIRECTORY/spec. Will run tests on files matching *_spec.rb.

puppet-docker test

Shortcut to run both the lint and spec tasks.

puppet-docker version

Output the version label for the dockerfile contained in DIRECTORY.

puppet-docker update-base-images

Update the base images. Any number of tags to update can be passed, or by default it will pull the latest version of: ['ubuntu:16.04', 'centos:7', 'alpine:3.4', 'debian:9', 'postgres:9.6.8']

Issues

File issues in the Community Package Repository (CPR) project with the 'Container' component.

License

See LICENSE file.

Maintainers

This project is maintained by the release engineering team [email protected] at Puppet, Inc.