Skip to content

Suggestion: Add source image option to docker push #38880

@gangefors

Description

@gangefors

Description
When building and pushing docker images in a shared environment (e.g. on a jenkins worker) there is always a possibility that between a build command and the following push command that someone else pulls the same tag as the one that is to be pushed.

This can result in a push of the other image instead of the one intended. The reason for this issue is that we can't set a source image when pushing, we have to use the same name on the local docker host as the name in the registry.

Steps to reproduce the issue:

  1. User 1: docker build -t myregistry/an-image:stable .
  2. User 2: docker pull myregistry/an-image:stable
  3. User 1: docker push myregistry/an-image:stable <- this will push the old image and not the one User 1 just built.

Suggestion

Add an option to docker push that allows users to specify which source image they want to push.
Example: docker push --source <image-id-or-name> NAME[:TAG]

This addition would allow users to minimize the risk of pushing the wrong image to the registry.
Adding an option ensures backward compatibility of the command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/builderBuildarea/distributionImage Distributioncontainerd-integrationIssues and PRs related to containerd integrationkind/enhancementEnhancements are not bugs or new features but can improve usability or performance.kind/featureFunctionality or other elements that the project doesn't currently have. Features are new and shinystatus/accepted

    Projects

    Status

    To do

    Status

    Optional

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions