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

container_run_and_commit does not support incremental loading. #1384

Closed
uri-canva opened this issue Jan 20, 2020 · 6 comments
Closed

container_run_and_commit does not support incremental loading. #1384

uri-canva opened this issue Jan 20, 2020 · 6 comments
Labels
Can Close? Will close in 30 days unless there is a comment indicating why not

Comments

@uri-canva
Copy link
Contributor

container_run_and_commit doesn't support incremental loading as output or input. I couldn't find out if it's because it was never implemented, or if it's a fundamental limitation due to having to interact with docker save. Even if it was due to docker save, it doesn't explain why it doesn't support incremental loading as input, as incremental loading does load the image into docker, so it should be possible to run commands in it?

Can this be clarified in the readme? https://github.com/bazelbuild/rules_docker/blob/b48dddfdad7764c6164701067c6e3736b8e707d7/docker/util/README.md

Related: #1281

@nlopezgi
Copy link
Contributor

Hi @uri-canva thanks for creating this issue. I think this is just never been implemented for this rule. We would be happy to accept contributions to either implement this feature for container_run_and_commit or document better the limitation better in the readme.

@uri-canva
Copy link
Contributor Author

I have put up a PR to support incremental loading as input: #1439

Supporting intermediate format as output seems to be more complicated since docker save does not support saving specific layers: moby/moby#3870, moby/moby#8039. The feature was implemented twice already moby/moby#5067, moby/moby#9304, but has been rejected both times.

The only API that is layer aware is the registry API: https://docs.docker.com/registry/spec/api/. It is possible to run either https://github.com/docker/distribution configured to use filesystem storage, then symlink / copy the existing layers where it expects them to be, or a simple http server that implements enough of the spec to handle image pushes, that pretends to have the previous layers.

Unfortunately this might require configuring the docker daemon to list localhost as an insecure registry, and hosting a local registry on mac or indows seems to get broken now and again: docker/for-mac#3611 docker/for-win#624 (it's not working for me on mac right now, I tested it by running the docker daemon in a VM).

This all smells pretty bad, I'm considering avoiding container_run_and_commit and instead build up images that require running programs inside the container using a combination of container_run_and_extract and container_image passing the extracted files, but that's not really nice either.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days.
Collaborators can add an assignee to keep this open indefinitely. Thanks for your contributions to rules_docker!

@github-actions github-actions bot added the Can Close? Will close in 30 days unless there is a comment indicating why not label Mar 18, 2021
@github-actions
Copy link

This issue was automatically closed because it went 30 days without a reply since it was labeled "Can Close?"

@uri-canva
Copy link
Contributor Author

Can this be reopened? I've updated my PR again: #1439

@amir-f
Copy link

amir-f commented Dec 19, 2022

Thanks Uri for trying to fix this. container_run_and_commit esp. on large images is really slow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Can Close? Will close in 30 days unless there is a comment indicating why not
Projects
None yet
Development

No branches or pull requests

3 participants