Skip to content

Container manipulated via multiple commands #226

@duglin

Description

@duglin

I was trying to think about how I would go about creating an image builder program using runc/OCI. I was envisioning something similar to Docker's builder/Dockerfile file processing but with one key difference, I wanted the long-sought-after 'squash' feature. I wanted the process used by this builder to be:
1 - create the container
2 - perform a set of actions to manipulate the container - cp files, run commands, etc...
3 - create an OCI compliant image from the resulting container

Even outside of this "builder" use case this would seem to be a fairly trivial use case that might be useful to lots of people.

But, I'm having trouble imagining how I would do this with today's spec and runc. The issues all seem to be around the process management side of things. In particular:

  • I can't create the container w/o also running a command
  • I can't run a command in a container w/o having an existing command already running

In #225 (and in other places) there's the start of a discussion around splitting create from start and I'd like to explore that some more. While I can certainly understand that in certain environments the authors of that environment might want to be very opinionated about the lifecycle of the processes in the containers (e.g. Docker goes out of its way to have the notion of a 'main' process which when it dies it kills all other processes), but as runc/OCI is a basic building block I don't see the value in requiring this view on everyone.

As mentioned in #225 (comment) I'm wondering why the ops we have aren't just:
1 - create container
2 - run a cmd in a container (irrespective of whether another cmd is already running)
3 - delete a container

Then 2 can be run as many times as needed by the tooling in order to do what the end user wants.

There are ways we could still support the opinionated path if we wanted. For example, if on the create() we passed in a cmd then let it do as we do today, but if there is no cmd then we do the flow above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions