Skip to content

Conversation

ewindisch
Copy link
Contributor

Initiates a pause before committing a container,
adds a pause option to the commit command, defaulting to 'true'.

Fixes #6267
Fixes #3675

Docker-DCO-1.1-Signed-off-by: Eric Windisch ewindisch@docker.com (github: ewindisch)

@@ -1522,6 +1522,7 @@ func (cli *DockerCli) CmdPs(args ...string) error {

func (cli *DockerCli) CmdCommit(args ...string) error {
cmd := cli.Subcmd("commit", "[OPTIONS] CONTAINER [REPOSITORY[:TAG]]", "Create a new image from a container's changes")
flPause := cmd.String([]string{"p", "-pause"}, "", "Pause container during commit")
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be a bool, false default to false

@cyphar
Copy link
Contributor

cyphar commented Jun 10, 2014

+1. This is crucial for making non-broken backups.

@crosbymichael
Copy link
Contributor

Build error
api/client/commands.go:1525: cannot use "" (type string) as type bool in function argument

@ewindisch
Copy link
Contributor Author

Yes, I broke the patch moving it from cmd.String to cmd.Bool. I'll update.

On Wed, Jun 11, 2014 at 10:47 AM, Michael Crosby notifications@github.com
wrote:

Build error
api/client/commands.go:1525: cannot use "" (type string) as type bool in
function argument


Reply to this email directly or view it on GitHub
#6276 (comment).

@imain
Copy link
Contributor

imain commented Jun 12, 2014

All I have to say is.. cool side effect.

@cyphar
Copy link
Contributor

cyphar commented Jun 12, 2014

@imain Haskell programmer, I take it? In all seriousness, in order to have verifiably sane backups, you need either:

  • Filesystem snapshots.
  • Freezable systems.

Of course, if all filesystems had snapshots, this wouldn't be an issue. However, since we live in the real world (with extN and vfat), we need to freeze the system before saving the container state.

@vieux vieux added this to the 1.0.1 milestone Jun 16, 2014
@@ -434,6 +434,12 @@ func postCommit(eng *engine.Engine, version version.Version, w http.ResponseWrit
utils.Errorf("%s", err)
}

if r.FormValue("pause") == "" && version.GreaterThanOrEqualTo("1.13") {
Copy link
Contributor

Choose a reason for hiding this comment

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

@ewindisch you need to bump the API version to 1.13

@vieux vieux self-assigned this Jun 16, 2014
@SvenDowideit
Copy link
Contributor

this needs to be documented

@unclejack
Copy link
Contributor

As @SvenDowideit has stated above, this PR needs documentation. It also requires cli integration tests to make sure it works.

@vieux
Copy link
Contributor

vieux commented Jun 18, 2014

@ewindisch do you have the time to do it or do you want me to ?

@ewindisch
Copy link
Contributor Author

@vieux I can do it, but not until Friday.

@crosbymichael crosbymichael removed this from the 1.0.1 milestone Jun 19, 2014
@vieux
Copy link
Contributor

vieux commented Jun 23, 2014

ping @ewindisch

@ewindisch
Copy link
Contributor Author

@vieux this was updated on June 21st with a test and doc update. I'm not particularly happy with the test, to be honest, but it has one.

@vieux
Copy link
Contributor

vieux commented Jun 24, 2014

@ewindisch sorry, feel free to ping me next time, I didn't notice.

during the process of commiting the image. This provides atomic copies which
prevent data corruption during the process of creating the commit. If this
behavior is undesired, set the 'p' option to false.

Copy link
Contributor

Choose a reason for hiding this comment

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

it pauses, but it doesn't tell the processes to flush, or wait for a process in the middle of writing, or call sync, so it doesn't prevent, it just reduces the risk?

@ewindisch
Copy link
Contributor Author

@SvenDowideit semantics? I see prevention as reduction of risk rather than a cure, e.x. phrases such as "prime prevention". If you have a better turn of phrase you'd rather see, I'm welcome to suggestions of alternatives.

I agree that sync should be used as well, something I intend as a follow-on, but imagine will be more controversial as there are several ways to do it with varying levels of impact to the system or Docker design (a discussion better left for later).

@vieux
Copy link
Contributor

vieux commented Jun 24, 2014

@ewindisch can you rebase and update the 1.13 api documentation & what's new please ?

@SvenDowideit
Copy link
Contributor

@ewindisch I would avoid using the word prevent and instead use something more like reduces - otherwise people will assume you really mean that it prevents, and be annoyed when a docker commit in the middle of a database backup creates a bad backup file (or whatever).

@vieux
Copy link
Contributor

vieux commented Jun 27, 2014

ping @ewindisch if you're done with @SvenDowideit I can carry the pr to merge (and update the doc)

@vieux vieux added this to the 1.0.2 milestone Jun 27, 2014
Initiates a pause before committing a container,
adds a pause option to the commit command, defaulting to 'true'.

Fixes bug: moby#6267
Fixes bug: moby#3675

Docker-DCO-1.1-Signed-off-by: Eric Windisch <ewindisch@docker.com> (github: ewindisch)
@ewindisch
Copy link
Contributor Author

@vieux: 👍 I certainly don't mind your help. I've updated the patch to rephrase the documentation and to bump the version number. It has also been rebased for good measure.

@SvenDowideit
Copy link
Contributor

LGTM - thank you for the more relaxed phrasing - might lead to one less support call :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pause (freeze) container during 'commit' Docker exports/diff/commits are racy
7 participants