Docker Platform

Run a Viash component on a Docker backend platform. By specifying which dependencies your component needs, users will be able to build a docker container from scratch using the setup flag, or pull it from a docker repository.

Example:

platforms:
  - type: docker
    image: "bash:4.0"
    setup:
      - type: apt
        packages: [ curl ]

chown

Type: Boolean

Default: True

In Linux, files created by a Docker container will be owned by root. With chown: true, Viash will automatically change the ownership of output files (arguments with type: file and direction: output) to the user running the Viash command after execution of the component. Default value: true.

Example:

chown: false

cmd

Type: Either - String - List of String

Default: Empty

Set the default command being executed when running the Docker container.

Examples:

Set CMD using the exec format, which is the prefered form.

cmd: ["echo", "$HOME"]

Set CMD using the shell format.

cmd: "echo $HOME"

entrypoint

Type: Either - String - List of String

Default: []

Override the entrypoint of the base container. Default set ENTRYPOINT [].

Examples:

Disable the default override.

entrypoint: 

Entrypoint of the container in the exec format, which is the prefered form.

entrypoint: ["top", "-b"]

Entrypoint of the container in the shell format.

entrypoint: "top -b"

id

Type: String

Default: docker

As with all platforms, you can give a platform a different name. By specifying id: foo, you can target this platform (only) by specifying -p foo in any of the Viash commands.

Example:

id: foo

image

Type: String

The base container to start from. You can also add the tag here if you wish.

Example:

image: "bash:4.0"

namespace_separator

Type: String

Default: /

The separator between the namespace and the name of the component, used for determining the image name. Default: "/".

Example:

namespace_separator: "_"

organization

Type: String

Default: Empty

Name of a container’s organization.

port

Type: String / List of String

Default: Empty

A list of enabled ports. This doesn’t change the Dockerfile but gets added as a command-line argument at runtime.

Example:

port:
  - 80
  - 8080

registry

Type: String

Default: Empty

The URL to the a custom Docker registry

Example:

registry: https://my-docker-registry.org

resolve_volume

Type: DockerResolveVolume

Default: Automatic

Enables or disables automatic volume mapping. Enabled when set to Automatic or disabled when set to Manual. Default: Automatic.

run_args

Type: String / List of String

Default: Empty

Add docker run arguments.

setup

Type: List of Requirements

Default: Empty

A list of requirements for installing the following types of packages:

The order in which these dependencies are specified determines the order in which they will be installed.

setup_strategy

Type: DockerSetupStrategy

Default: ifneedbepullelsecachedbuild

The Docker setup strategy to use when building a container.

Strategy Description
alwaysbuild / build / b Always build the image from the dockerfile. This is the default setup strategy.
alwayscachedbuild / cachedbuild / cb Always build the image from the dockerfile, with caching enabled.
ifneedbebuild Build the image if it does not exist locally.
ifneedbecachedbuild Build the image with caching enabled if it does not exist locally, with caching enabled.
alwayspull / pull / p Try to pull the container from Docker Hub or the specified docker registry.
alwayspullelsebuild / pullelsebuild Try to pull the image from a registry and build it if it doesn’t exist.
alwayspullelsecachedbuild / pullelsecachedbuild Try to pull the image from a registry and build it with caching if it doesn’t exist.
ifneedbepull If the image does not exist locally, pull the image.
ifneedbepullelsebuild If the image does not exist locally, pull the image. If the image does exist, build it.
ifneedbepullelsecachedbuild If the image does not exist locally, pull the image. If the image does exist, build it with caching enabled.
push Push the container to Docker Hub or the specified docker registry.
pushifnotpresent Push the container to Docker Hub or the specified docker registry if the tag does not exist yet.
donothing / meh Do not build or pull anything.

Example:

setup_strategy: alwaysbuild

tag

Type: String

Default: Empty

Specify a Docker image based on its tag.

Example:

tag: 4.0

target_image

Type: String

Default: Empty

If anything is specified in the setup section, running the ---setup will result in an image with the name of <target_image>:<version>. If nothing is specified in the setup section, simply image will be used. Advanced usage only.

Example:

target_image: myfoo

target_image_source

Type: String

Default: Empty

The source of the target image. This is used for defining labels in the dockerfile.

Example:

target_image_source: https://github.com/foo/bar

target_organization

Type: String

Default: Empty

The organization set in the resulting image. Advanced usage only.

Example:

target_organization: viash-io

target_registry

Type: String

Default: Empty

The URL where the resulting image will be pushed to. Advanced usage only.

Example:

target_registry: https://my-docker-registry.org

target_tag

Type: String

Default: Empty

The tag the resulting image gets. Advanced usage only.

Example:

target_tag: 0.5.0

test_setup

Type: List of Requirements

Default: Empty

Additional requirements specific for running unit tests.

type

Type: String

Specifies the type of the platform.

workdir

Type: String

Default: Empty

The working directory when starting the container. This doesn’t change the Dockerfile but gets added as a command-line argument at runtime.

Example:

workdir: /home/user