Skip to content

Generalised ContainerRequirement #80

Open

Description

@jrandall

Docker is great, but other container packaging and execution tools exist and it would be unfortunate for workflow authors to require a specific dependency on docker when docker-specific features are not actually required.

I suggest that it would be advantageous for CWL to support a more generic ContainerRequirement which extends ProcessRequirement and that specifies the minimum set of parameters necessary to support containerisation without any docker-specific features. This could simply consist of a content address that describes the contents of the container rootfs along with a pointer to where/how to obtain one (i.e. a URL), along with specifying the semantics of how to map a CommandLineTool into the generic container (the ability to run a command line within a container seems like it ought to be fundamental to any container executor, but perhaps we need to be explicit about what the default environment should be). Both the content address and the URL could be optional (required=False).

The existing DockerRequirement would be retained, but modified to extend ContainerRequirement rather than extending ProcessRequirement directly. The purpose of DockerRequirement would be to specify docker-specific functionality, including how to obtain a container using docker pull/load/file/imageid.

It would be valid to specify both ContainerRequirement and DockerRequirement -- the semantics of this would depend on whether they are specified in requirements or hints. Here is one way it might work:

ContainerRequirement in requirements, DockerRequirement in requirements: specifically require the docker container executor, but after obtaining the docker image as specified in the DockerRequirement, calculate the rootfs content address and require that it matches the one specified in the ContainerRequirement (if specified).

ContainerRequirement in requirements, DockerRequirement in hints: require containerisation and that the rootfs matches the specified content-address, but the implementation can choose to obtain the image from the URL specified in ContainerRequirement or the docker-specific mechanism specified in DockerRequirement (or in future from another container system's mechanism if it is hinted at as well).

ContainerRequirement in hints, DockerRequirement in requirements: specifically require docker and obtain the container following docker-specific semantics. Check the content address of the container if specified in ContainerRequirement but continue running (perhaps with a warning) if it doesn't match what is obtained via docker.

ContainerRequirement in hints, DockerRequirement in hints: the implementation is free to choose to use docker or another containerisation system, or to not use containerisation at all. Warnings may be issued if the ContainerRequirement rootfs content address does not match what is provided from docker.

In future, other specific container systems could be added to support specific semantics or container image discovery mechanisms, but the common requirement for ContainerRequirement can always be specified to enforce checking of the rootfs content-address.

Activity

  1. changed the title [-]Generalise ContainerRequirement[/-] [+]Generalised ContainerRequirement[/+] on Jul 9, 2015
  2. jrandall commented on Jul 11, 2015

    @jrandall
    MemberAuthor

    It would be nice if ContainerRequirement would generalise far enough that a runtime could implement it with a full VM (or perhaps even booting a physical machine with the specified rootfs) rather than using a lightweight Linux container. To support this, the ContainerRequirement could also have parameters specifying machine architecture and OS/kernel version. Alternatively, those requirements could be captured in another high-level requirement or requirements (perhaps MachineRequirement?). The problem with splitting them up would be that some steps could specify ways to realise them using multiple architectures (i.e. the ContainerRequirement is associated with a specific architecture and kernel).

  3. jrandall commented on Jul 21, 2015

    @jrandall
    MemberAuthor

    Interesting. CommandMatchesRequirement could also be a generic way to support verification of what container one has as well (because you could codify the validation that you have what you are supposed to have as a command to be run from inside the container).

    For example:

    requirements: 
      class: CommandMatchesRequirement
      command: find / -fstype "proc" -prune -o -fstype "sysfs" -prune -o -fstype "devpts" -prune -o -print | LC_ALL=C sort | cpio -o | md5sum | awk '{print $1}'
      matchesSubstring: 6fe91993f4046da88b4639c0671f36cc
    hints:
      - class: DockerRequirement
        dockerPull: ubuntu:14.04

    However, this would be a very expensive operation to run and it would be best if an implementation cached the result. Could we specify that all CommandMatchesRequirement commands are supposed to be pure (so that they could be cached for a particular environment)?

  4. tetron commented on Oct 6, 2015

    @tetron
    Member

    A few ideas for alternate ways of hosting a runtime that is sufficient to satisfy tool dependencies but isn't Docker:

  5. kdm9 commented on Feb 1, 2016

    @kdm9

    This ties in very closely with the work I will be doing with @mr-c, a brief overview of which is in the wiki at Userspace Container Review.

  6. mr-c commented on Jul 18, 2016

    @mr-c
    Member

    A tangent on this issue discussed specifying software requirements, which is now covered by http://www.commonwl.org/v1.0/CommandLineTool.html#SoftwareRequirement

    @jrandall is there a specific containerization technology that you'd like to see as a sibling to DockerRequirement?

  7. added this to the unscheduled milestone on Jul 18, 2016
  8. reopened this on Dec 13, 2016
  9. added a commit that references this issue on Jul 20, 2017
  10. modified the milestones: unscheduled, on Jan 16, 2018
  11. added a commit that references this issue on Mar 21, 2018
  12. cwl-bot commented on Oct 7, 2021

    @cwl-bot

    This issue has been mentioned on Common Workflow Language Discourse. There might be relevant details there:

    https://cwl.discourse.group/t/dockerrequirement-vs-containerrequirement/462/2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions