跳到主要内容

Run Docker container with YAML

List of YAML parameters and examples for the "Run Docker Container" action along with YAML examples.

YAML parameters for Run Docker container

名称类型描述
action
必填
StringThe ID of the action.
type
必填
StringThe type of the action. Should be set to RUN_DOCKER_CONTAINER.
docker_image_name
必填
StringThe name of the Docker image.
docker_image_tag
必填
StringThe tag of the Docker image.
inline_commands
必填
StringThe commands that will be executed.
mount_filesystem_disableBooleanDefines whether or not to mount the filesystem to the running container.
volume_mappingsString[]The path preceding the colon is the filesystem path (the folder from the filesystem to be mounted in the container). The path after the colon is the container path (the path in the container, where this filesystem will be located).
loginStringThe username required to connect to a private registry.
passwordStringThe password required to connect to a private registry.
registryStringThe url to the Docker registry or GCR. Required for Google GCR.
export_container_pathStringDefines the export path of the container’s filesystem as a tar archive.
integration_hashStringThe ID of the integration. Required for using the image from the Amazon ECR, Google GCR or Docker Hub.
regionStringThe name of the Amazon S3 region. Required for using the image from the Amazon ECR. The full list of regions is available here.
use_image_from_actionBooleanIf set to true the Docker image will be taken from action defined by docker_build_action_id.
run_as_userStringAll build commands are run as the default user defined in the selected Docker image. Can be set to another username (on the condition that this user exists in the selected image).
docker_build_action_idIntegerThe ID of the action which built the desired Docker image. If set to 0, the image will be taken from previous pipeline action. Can be used instead of docker_build_action_name.
docker_build_action_nameStringThe name of the action which built the desired Docker image. Can be used instead of docker_build_action_id.
entrypointStringDefault command to execute at runtime. Overwrites the default entrypoint set by the image.

YAML example for Run Docker container

actions:
- action: "Run container"
type: "RUN_DOCKER_CONTAINER"
docker_image_name: "library/ubuntu"
docker_image_tag: "latest"
volume_mappings:
- "/:/buddy/mount/directory"
inline_commands: "ls -al > ls.log"
mount_filesystem_disable: false
working_directory: "/buddy/my-repo-dir"
export_container_path: "/exportPath"
entrypoint: "/bin/sh"
variables:
- key: "ftp_login"
value: "userLogin123"
description: "The name of user to FTP."
- key: "ftp_password"
value: "secure!14ivLMxPgv7TX6c9+ITX/g=="
encrypted: true
description: "The password for ftp."

YAML example for using private image from Dockerhub

actions:
- action: "Run container"
type: "RUN_DOCKER_CONTAINER"
docker_image_name: "buddyworks/private_image"
docker_image_tag: "latest"
inline_commands: "ls -al > ls.log"
mount_filesystem_disable: false
working_directory: "/buddy/my-repo-dir"
integration_hash: "5ddb7c180fb38be67bd78a88a"
run_as_user: "${user}"
export_container_path: "/exportPath"
entrypoint: "/bin/sh"
variables:
- key: "user"
value: "notRoot"
- key: "top_secret_password"
value: "secure!14ivLMxPgv7TX6c9+ITX/g=="
encrypted: true

YAML example for using image from private registry

actions:
- action: "Run container"
type: "RUN_DOCKER_CONTAINER"
docker_image_name: "buddyworks/private_image"
docker_image_tag: "latest"
entrypoint: "/bin/sh"
volume_mappings:
- "/:/buddy/mount/directory"
inline_commands: "ls -al > ls.log"
mount_filesystem_disable: false
working_directory: "/buddy/my-repo-dir"
login: "buddyworks"
password: "${top_secret_password}"
registry: "my.registry.com"

YAML example for using image from Google Container Registry

actions:
- action: "Run container"
type: "RUN_DOCKER_CONTAINER"
docker_image_name: "tokyo-house-147623/private_image"
docker_image_tag: "latest"
volume_mappings:
- "/:/buddy/mount/directory"
inline_commands: "ls -al > ls.log"
mount_filesystem_disable: false
working_directory: "/buddy/my-repo-dir"
export_container_path: "/exportPath"
entrypoint: "/bin/sh"
registry: "my.gcr.com"
integration_hash: "5ddb7c180fb38be67bd78a88a"

YAML example for using image from Amazon ECR

actions:
- action: "Run container"
type: "RUN_DOCKER_CONTAINER"
docker_image_name: "private_image"
docker_image_tag: "latest"
entrypoint: "/bin/sh"
volume_mappings:
- "/:/buddy/mount/directory"
inline_commands: "ls -al > ls.log"
mount_filesystem_disable: false
working_directory: "/buddy/my-repo-dir"
region: "us-east-1"
integration_hash: "5ddb7c180fb38be67bd78a88a"

YAML example for using image built in previous action

actions:
- action: "Run container"
type: "RUN_DOCKER_CONTAINER"
use_image_from_action: true
volume_mappings:
- "/:/buddy/mount/directory"
docker_build_action_id: 0
inline_commands: "ls -al > ls.log"
mount_filesystem_disable: false
export_container_path: "/exportPath"
entrypoint: "/bin/sh"
working_directory: "/buddy/my-repo-dir"