-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
docker commit should not drop configuration #1141
Comments
What configuration are you thinking of? E.g. dns? mounted volumes? |
i had volumes and the cmd in mind. |
👍 this hit me hard today :-/ Built up quite a huge Dockerfile with lots of ports EXPOSEd. If I do some work in the container and want to commit as a new image, all ports and also CMD is lost. |
+1 On Fri, Sep 13, 2013 at 9:55 AM, asbjornenge [email protected]:
@jpetazzo https://twitter.com/jpetazzo |
This was a big one for me today as well! |
A friendly tip (might be obvious to most): As a workaround I just keep a separate Dockerfile with only the configuration stuff that is lost, and the image I'm committing to as FROM. It's not awesome, but it works. |
Haha! A dirty hack, but I will use it 'til we see this closed! Thanks. :) |
+1 |
+1 |
1 similar comment
+1 |
+1 In addition, I know you can do |
ping @shykes, any thoughts? |
+1 on preserving cmd, ports, env, etc. |
I believe this has been fixed, @creack @crosbymichael @vieux can you confirm? |
No this is still and issue with Tagging as easy fix |
Any progress on this? Got bit by this today on 0.7.6. |
I'm working on this issue, and it is indeed mostly an easy fix. But the wrinkle I've run into is figuring out when the user has specified a new config via commit's -run option. Hopefully there's an easy solution for someone who's been using Go for more than a few minutes. Here's my progress so far: https://github.com/cap10morgan/docker/compare/fix-issue-1141 The I've tried comparing the Config struct to an empty one (Config{}), but that doesn't work because there are slice members and they don't support equality comparison. I've also tried checking for no incoming config JSON, but something in the command -> API -> server cycle is putting an empty struct's JSON representation in there anyway, so that's stuck at the same place. So does anyone have any tips for a robust way of detecting when the user has submitted a new config on the commit command line? OR Should I just work on a shallow merge function that leaves the original container's config values there when there is no value in the request's config but otherwise clobbers it with the request's config values? This would be more work, I think, but if it's the right thing to do (and it seems like it is), then it would obviate the need to detect whether someone had given any config values via the -run option (since they'll all be empty and thus won't override the original container's config). |
Update: I just found CompareConfig and MergeConfig in utils.go. I'll just use MergeConfig. |
Pull request here: #3889 |
+1 |
I closed that PR so I could submit a new one that follows the Docker contrib guidelines a bit better and adds a test. However, I'm a bit stuck on the best way to test that the merged config is correct: cap10morgan@2cf4727 Any tips would be most welcome. |
Fixes moby#1141 Docker-DCO-1.1-Signed-off-by: Wes Morgan <[email protected]> (github: cap10morgan)
+1 |
Fixes moby#1141 Docker-DCO-1.1-Signed-off-by: Wes Morgan <[email protected]> (github: cap10morgan)
Currently when doing a commit on a container to update an image, the configuration the image had is not kept.
I think there should be an option to drop the previous config and a default to keep it.
The text was updated successfully, but these errors were encountered: