Skip to main content

Container API reference

概要

The container configuration for both Workflow containers and service containers allows multiple options in addition to the image name and version.

Beta feature

This feature is in beta and we do not recommend using it with production applications. Register here for the beta.

The container configuration for both Workflow containers and service containers allows multiple options in addition to the image name and version.

表1 Workflow container API reference

Name

Description

workflows.<workflow_id>.container.image

The docker image to use for the the Workflow in [REPOSITORY[:TAG]] format.

container:
  image: us.gcr.io/my-project/my-image:v2

workflows.<workflow_id>.container.credentials.*

The credentials allow you to control the parameters supplied for the docker login command. Check your registries documentation on how to use docker login.

container:
  image: us.gcr.io/my-project/my-image:v2
  credentials:
    username: _json_key_base64
    password: $GCP_SERVICE_ACCOUNT
    # Server is optional if already part of the image
    server: us-central1-docker.pkg.dev

workflows.<workflow_id>.container.credentials.username

The username that will be used with the docker login command.

workflows.<workflow_id>.container.credentials.password

The password that will be used with the docker login command.

Use a secret

You can reference a Bitrise Secret to avoid exposing your password in the bitrise.yml file.

workflows.<workflow_id>.container.credentials.server

The server for the docker login command. This is optional if the server is already part of the image reference.

workflows.<workflow_id>.container.ports

An array of port mappings that will be be exposed on the host in the format of [HostPort]:[ContainerPort].

container:
  image: python:3.8
  ports:
  - "3000:3000"

workflows.<workflow_id>.container.envs

List of Environment Variables.  Each individual variable must be in its own single length array.

Using the env property

Using the Workflow level env property will also work: containers inherit those, too.

container:
  image: python:3.8
  envs:
  - MY_VAR: my_value
  - ANOTHER_VAR: another_value

workflows.<workflow_id>.container.options

Used to configure additional Docker container resource options (parameters that will be passed to the docker create command).

Not supported options

--network, --volume (-v), and --entrypoint are not supported.


表2 Service container API reference

Name

Description

workflows.<workflow_id>.services.*

You can define multiple services per Workflow. All of these services will be created before the Steps of the Workflow are executed. Each service container will be running in the same docker network called bitrise. On top of that the ports defined on a service will be exposed on the host, to be used from non-container workflows.

Accessing services

Service containers can be used even when the Workflow itself is not using containers. The only difference is how to access the services.

Use the <service_id> (name of the service) to access it when you are using Workflow container. For example, http://postgres:5432.

Use localhost to access your service if you are not using a Workflow container. Fore example, http://localhost:5432.

workflows.<workflow_id>.container.credentials.*

The credentials allow you to control the parameters supplied for the docker login command. Check your registries documentation on how to use docker login.

container:
  image: us.gcr.io/my-project/my-image:v2
  credentials:
    username: _json_key_base64
    password: $GCP_SERVICE_ACCOUNT
    # Server is optional if already part of the image
    server: us-central1-docker.pkg.dev

workflows.<workflow_id>.services.<service_id>.container.image

The docker image to use for the the Workflow in [REPOSITORY[:TAG]] format

container:
  image: us.gcr.io/my-project/my-image:v2

workflows.<workflow_id>.services.<service_id>.container.credentials.username

The username that will be used with the docker login command.

workflows.<workflow_id>.services.<service_id>.container.credentials.password

The password that will be used with the docker login command.

Use a secret

You can reference a Bitrise Secret to avoid exposing your password in the bitrise.yml file.

workflows.<workflow_id>.services.<service_id>.container.credentials.server

The server for the docker login command. This is optional if the server is already part of the image reference.

workflows.<workflow_id>.services.<service_id>.container.ports

An array of port mappings that will be be exposed on the host in the format of [HostPort]:[ContainerPort].

container:
  image: python:3.8
  ports:
  - "3000:3000"

workflows.<workflow_id>.services.<service_id>.container.envs

List of environment variables.  Each individual variable must be in its own single length array.

Using the env property

Using the Workflow level env property will also work: containers inherit those, too.

container:
  image: python:3.8
  envs:
  - MY_VAR: my_value
  - ANOTHER_VAR: another_value

workflows.<workflow_id>.services.<service_id>.container.options

Used to configure additional Docker container resource options (parameters that will be passed to the docker create command).

Not supported options

--network, --volume (-v), and --entrypoint are not supported.