Skip to content
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

speed up docker save process #8

Closed
bigdataolddriver opened this issue Oct 17, 2019 · 1 comment
Closed

speed up docker save process #8

bigdataolddriver opened this issue Oct 17, 2019 · 1 comment

Comments

@bigdataolddriver
Copy link

the tar file generated from "docker save" is optionally keeped by the control of KEEPDIR , which I understand mostly for debugging purpose.
but even KEEPDIR =0, the tar file is always saved on disk, only deleted afterwards
I am a bit impatient and did following patch , pipe-lining with tee , to save disk IO, save time

23c23
< KEEPDIR = 1

KEEPDIR = 0
251,256c251,254
< if KEEPDIR >= 2:
< cmd = "docker save {inp} |tee {inputfile}|tar x -f - -C {datadir}"
< sh(cmd.format(**locals()))
< else:
< cmd = "docker save {inp} |tar x -f - -C {datadir}"
< sh(cmd.format(**locals()))


    cmd = "docker save {inp} -o {inputfile}"
    sh(cmd.format(**locals()))
    cmd = "tar xf {inputfile} -C {datadir}"
    sh(cmd.format(**locals()))

280,284c278,282
< # if KEEPDIR >= 2:
< # logg.warning("keeping %s", inputfile)
< # else:
< # if os.path.exists(inputfile):
< # os.remove(inputfile)

    if KEEPDIR >= 2:
        logg.warning("keeping %s", inputfile)
    else:
        if os.path.exists(inputfile):
            os.remove(inputfile)
@gdraheim
Copy link
Owner

Sorry for the late answer. You are right, the default should be to not create a saved.tar but to have the files unpacked from a pipe.

However I wanted to have it differently which took a while. So the new version of docker-edit.py can select the keep-options seperately (backed with tests now).

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

No branches or pull requests

2 participants