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.

apk

Type: ApkRequirements

Warning

Deprecated since Viash 0.5.15. Use setup instead.

Specify which apk packages should be available in order to run the component.

Example:

setup:
  - type: apk
    packages: [ sl ]

apt

Type: AptRequirements

Warning

Deprecated since Viash 0.5.15. Use setup instead.

Specify which apt packages should be available in order to run the component.

Example:

setup:
  - type: apt
    packages: [ sl ]

chown

Type: Boolean

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

docker

Type: DockerRequirements

Warning

Deprecated since Viash 0.5.15. Use setup instead.

Specify which Docker commands should be run during setup.

Example:

setup:
  - type: docker
    build_args: [ GITHUB_PAT=hello_world ]
    run: [ git clone ... ]
    add: [ "http://foo.bar ." ]
    copy: [ "http://foo.bar ." ]
    resources: 
      - resource.txt /path/to/resource.txt

id

Type: String

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

The default namespace separator is “_“.

Example:

namespace_separator: "+"

organization

Type: String

Name of a container’s organization.

port

Type: String / List of String

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

privileged

Type: Boolean

Warning

Deprecated since Viash 0.6.3. Add a privileged flag in run_args instead.

Adds a privileged flag to the docker run.

python

Type: PythonRequirements

Warning

Deprecated since Viash 0.5.15. Use setup instead.

Specify which Python packages should be available in order to run the component.

Example:

setup:
  - type: python
    pip: [ numpy ]
    git: [ https://some.git.repository/org/repo ]
    github: [ jkbr/httpie ]
    gitlab: [ foo/bar ]
    mercurial: [ http://... ]
    svn: [ http://...]
    bazaar: [ http://... ]
    url: [ http://... ]

r

Type: RRequirements

Warning

Deprecated since Viash 0.5.15. Use setup instead.

Specify which R packages should be available in order to run the component.

Example:

setup: 
  - type: r
    cran: [ dynutils ]
    bioc: [ AnnotationDbi ]
    git: [ https://some.git.repository/org/repo ]
    github: [ rcannood/SCORPIUS ]
    gitlab: [ org/package ]
    svn: [ https://path.to.svn/group/repo ]
    url: [ https://github.com/hadley/stringr/archive/HEAD.zip ]
    script: [ 'devtools::install(".")' ]

registry

Type: String

The URL to the a custom Docker registry

Example:

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

resolve_volume

Type: DockerResolveVolume

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

Add docker run arguments.

setup

Type: List of Requirements

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

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

Specify a Docker image based on its tag.

Example:

tag: 4.0

target_image

Type: String

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

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

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

Example:

target_organization: viash-io

target_registry

Type: String

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

The tag the resulting image gets. Advanced usage only.

Example:

target_tag: 0.5.0

test_setup

Type: List of Requirements

Additional requirements specific for running unit tests.

type

Type: String

Specifies the type of the platform.

workdir

Type: String

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

yum

Type: YumRequirements

Warning

Deprecated since Viash 0.5.15. Use setup instead.

Specify which yum packages should be available in order to run the component.

Example:

setup:
  - type: yum
    packages: [ sl ]