Toolset to build docker containers
Use build.sh
to build your new container:
$ ./build.sh ansible
docker builder's build.sh
is configured with environment variables, and is
primarily intended for use inside Jenkins builds. The following variables
control its behavior:
DOCKER_LATEST=true
- Adds a:latest
tag for the containerDOCKER_PUSH=true
- Push the container to the repository after buildingDOCKER_FORCE=true
- Build the container even if it already exists
Take care invoking with DOCKER_LATEST=true
and DOCKER_PUSH=true
, as it
will overwrite the 'latest' tag in the registry.
docker-builder's build.sh
automatically names and tags instances based on the
following:
name:<checksum>
- git short commit hash for the shipyard reponame:<version>
- if specified in Metadataname:latest
- ifDOCKER_LATEST=true
To start a new project, create a Dockerfile under a new directory. We'll use
the ansible
Dockerfile as an example.
$ mkdir -p ansible/
$ cd ansible
$ vim Dockerfile
docker-builder's build.sh
looks for configuration metadata comments inside the
target Dockerfile:
# NAME
The first part of the tag# VERSION
The last part of the tag
Given the following header, build.sh
would create a container tagged
dockerhub/rickrussell/ansible:2.2.0
:
# NAME rickrussell/ansible
# VERSION 2.2.0