This is a Docker mixin for Porter. The mixin provides the Docker CLI.
To use this mixin in a bundle, declare it like so:
mixins:
- docker
The Docker client version can be specified via the clientVersion
configuration when declaring this mixin. The default client version is currently set to 20.10.7.
- docker:
clientVersion: 20.10.7
The commands available are docker pull, push, build, run, remove, and login.
The same syntax applies for install, upgrade, and uninstall.
You can specify either the tag or the digest.
- docker:
description: "Description of the command"
pull:
name: IMAGE_NAME
tag: IMAGE_TAG
digest: IMAGE_DIGEST
arguments:
- arg1
- arg2
flags:
FLAGNAME: FLAGVALUE
REPEATED_FLAG:
- FLAGVALUE1
- FLAGVALUE2
- docker:
description: "Install Whalesay"
pull:
name: docker/whalesay
tag: latest
- docker:
description: "Description of the command"
push:
name: IMAGE_NAME
tag: IMAGE_TAG
arguments:
- arg1
- arg2
flags:
FLAGNAME: FLAGVALUE
REPEATED_FLAG:
- FLAGVALUE1
- FLAGVALUE2
- docker:
description: "Push image"
push:
name: gmadhok/cookies
tag: v1.0
- docker:
description: "Description of the command"
build:
tag: IMAGE_TAG
file: Dockerfile #OPTIONAL
path: PATH #defaults to "." OPTIONAL
arguments:
- arg1
- arg2
flags:
FLAGNAME: FLAGVALUE
REPEATED_FLAG:
- FLAGVALUE1
- FLAGVALUE2
- docker:
description: "Build image"
build:
tag: "gmadhok/cookies:v1.0"
file: Dockerfile
- docker:
description: "Description of the command"
run:
image: IMAGE
name: NAME
detach: BOOL #defaults to false
ports:
- host: NUMBER # porter exposed on the host
container: NUMBER # port exposed by the container
env:
variable: VALUE
privileged: BOOL #defaults to false
rm: BOOL #defaults to false
command: COMMAND
arguments:
- arg1
- arg2
flags:
FLAGNAME: FLAGVALUE
REPEATED_FLAG:
- FLAGVALUE1
- FLAGVALUE2
suppress-output: BOOL #defaults to false
- docker:
description: "Run Whalesay"
run:
name: mixinpractice
image: "docker/whalesay:latest"
detach: true
ports:
- host: 8080
container: 80
env:
myvar: "whales"
privileged: true
rm: true
command: cowsay
arguments:
- "Hello World"
- docker:
description: "Description of the command"
remove:
container: CONTAINER_NAME
force: BOOL #defaults to false
arguments:
- arg1
- arg2
flags:
FLAGNAME: FLAGVALUE
REPEATED_FLAG:
- FLAGVALUE1
- FLAGVALUE2
- docker:
description: "Remove mixinpractice"
remove:
container: mixinpractice
force: true
Username and password are optional because the mixin will default to using environment variables provided by DOCKER_USERNAME and DOCKER_PASSWORD from a parameter or a credential. See an example for how to use docker login and securely provide your username and password.
- docker:
description: "Description of the command"
login:
username: USERNAME #OPTIONAL
password: PASSWORD #OPTIONAL
arguments:
- arg1
- arg2
flags:
FLAGNAME: FLAGVALUE
REPEATED_FLAG:
- FLAGVALUE1
- FLAGVALUE2
- docker:
description: "Login to docker"
login:
Use of this mixin requires opting-in to Docker host access via a Porter setting. See the Porter documentation for further details.
Here we opt-in via the CLI flag, --allow-docker-host-access
:
$ porter install --allow-docker-host-access