Skip to content

history: add export command #3073

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

Merged
merged 2 commits into from
Mar 28, 2025

Conversation

tonistiigi
Copy link
Member

@tonistiigi tonistiigi commented Mar 19, 2025

part of #2711

Allow builds to be exported into .dockerbuild bundles that can be shared and imported into Docker Desktop.

Copy link
Member

@crazy-max crazy-max left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When exporting a build record and importing it back, the name is not the same:

image

I think this is because we don't check the local state for imported builds in desktop-build backend on Docker Desktop. Maybe we could set the builder and node name as annotation in the export bundle so we can look if a local state exists for this ref? WDYT?

cmd := &cobra.Command{
Use: "export [OPTIONS] [REF]",
Short: "Export a build into Docker Desktop bundle",
Args: cobra.MaximumNArgs(1),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want feature parity with export-build tool, I think we should allow multiple refs to be exported. This is needed for GHA case when exporting bake builds.

Also the export-build exports all records for the builder being used if no refs are set but I think to be consistent with other history commands this is fine to export the first one. So maybe we could have an --all flag for such case?


cmd := &cobra.Command{
Use: "export [OPTIONS] [REF]",
Short: "Export a build into Docker Desktop bundle",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if "Docker Desktop" should be stipulated here. I think the following is enough:

Suggested change
Short: "Export a build into Docker Desktop bundle",
Short: "Export build records",

or

Suggested change
Short: "Export a build into Docker Desktop bundle",
Short: "Export build records bundle",

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also there are some places where we talk about build and other build record. I think we should be consistent:

Short: "Import a build into Docker Desktop",

Import build records into Docker Desktop

Short: "Print the logs of a build",

Print the logs of a build record

Short: "Open a build in Docker Desktop",

Open a build record in Docker Desktop

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if "Docker Desktop" should be stipulated here. I think the following is enough:

It kind of shows what you can do with the bundle file.

@tonistiigi
Copy link
Member Author

Added support for --all and multiple refs.

Allow builds to be exported into .dockerbuild bundles
that can be shared and imported into Docker Desktop.

Signed-off-by: Tonis Tiigi <[email protected]>
@tonistiigi tonistiigi force-pushed the add-trace-export-command branch 4 times, most recently from 367fc9c to 3e56b2e Compare March 21, 2025 03:41
@tonistiigi tonistiigi force-pushed the add-trace-export-command branch from 3e56b2e to 45dfb84 Compare March 21, 2025 18:21
Copy link
Member

@crazy-max crazy-max left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging this one.

We need a follow-up for consistency in command descriptions related to #3073 (comment)

I will open an issue to track work that needs to be done on GHA to use this command instead of export-build tool.

And also needs documentation for all history commands and probably new manual in https://docs.docker.com/build/? Can someone from your team take care of it @usha-mandya?

@crazy-max crazy-max merged commit 8593e03 into docker:master Mar 28, 2025
140 checks passed
@crazy-max crazy-max added this to the v0.23.0 milestone Apr 9, 2025
@crazy-max crazy-max mentioned this pull request Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants