New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strip reserved (com.docker. io.docker, org.dockerproject) labels on docker commit #42037
base: master
Are you sure you want to change the base?
Conversation
Tentatively adding a "cherry-pick" label, but we can discuss if this is too much of a behavior change to consider for a patch release |
a71e7f3
to
667733e
Compare
api/types/backend/backend.go
Outdated
Comment string | ||
Config *container.Config | ||
Changes []string | ||
KeepReservedLabels bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh! Good one, hmmm.. I think I originally thought it may be needed if there's uses elsewhere that need the old behavior, but I didn't do that in the end; let me remove
Extract the prefix-check to a function Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
…ocker commit Docker uses reserved label namespaces on containers to store runtime information. For example, when creating a service (`docker service create`), deploying a stack (`docker stack deploy`), or running a compose project (`docker-compose up`), docker respectively adds `com.docker.swarm`, `com.docker.stack`, and `com.docker.compose` labels to store metadata used at runtime. These labels are not set by users, but when commiting such a container, they currently end up in the image that was committed. This patch updates `CreateImageFromContainer` to remove labels in the reserved namespace. Some remarks should be made to this change: - This patch only accounts for `docker commit`; `docker build` still allows committing labels in the reserved namespaces - Because of the above, committing a container that was started from an image that has labels in the reserved namespaces, will strip these labels, and thus remove the labels from the image that is created. - Other actions (`docker run`, `docker create`) still allow these labels to be set, and also inherit these labels if they're started from an image that has labels in the reserved namespaces. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
667733e
to
13edc7f
Compare
Discussing in the maintainers meeting, and we can exclude all labels on commit. The classic builder probably doesn't not need it - we need to double check this ( |
Docker uses reserved label namespaces on containers to store runtime information.
For example, when creating a service (
docker service create
), deploying a stack(
docker stack deploy
), or running a compose project (docker-compose up
),docker respectively adds
com.docker.swarm
,com.docker.stack
, andcom.docker.compose
labels to store metadata used at runtime.These labels are not set by users, but when commiting such a container, they
currently end up in the image that was committed.
This patch updates
CreateImageFromContainer
to remove labels in the reservednamespace.
Some remarks should be made to this change:
docker commit
;docker build
still allowscommitting labels in the reserved namespaces
that has labels in the reserved namespaces, will strip these labels, and
thus remove the labels from the image that is created.
docker run
,docker create
) still allow these labels to beset, and also inherit these labels if they're started from an image that
has labels in the reserved namespaces.
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)