docker / docker/docker-py

[feature] "run" + "commit" a container takes at least a few lines of codes

Open
#2,817 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.2k
Forks
1.7k
Avg merge
13d 8h
Merged PRs (30d)
2

Description

Not sure if this is a reasonable thing to add to docker and/or docker-py. So asking here. I haven't come across with similar suggestions/discussions on this repo.

Problem to be aimed at

The workflow like below for an already-built Docker image is a popular need for me.
There's no way AFAIK with the docker-py API to do this with a single command/method call.

docker run --> do stuff in the container --> docker commit (with the same tag of the Docker image running a container of.)

Lack of such a functionality leads me to make a util method that calls run and commit. On multiple different projects/repos, this would result in duplicating the same/similar codes.

Background

  • Where single threaded environment, achieving run + commit with fewer commands/methods call is advantageous.
    • I'm on Gitlab CI. docker run, do stuff in the container, then docker commit on CI configuration cannot be done from a single threaded CLI (or at least I don't know how to achieve that in a reasonaly simple way).
  • Whether this functionality should be added to docker-py or somewhere else is a question. I'm mainly concerned with Python API, so posting here.

Potential solution

  • A new method to execute run + commit altogether.

Env

At the time of writing:

  • docker-py-1.10.6

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names docker-py's run and commit calls as entry points; start by reviewing those APIs and the linked commit documentation. The proposal leaves the API boundary and lifecycle semantics open, so establish the intended behavior with maintainers first; done would be an agreed single-call design with validation for the requested workflow.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
api, devops, infrastructure
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.