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

Strange difference in behaviour between docker import and importing via the API #447

Open
Nereuxofficial opened this issue Aug 5, 2024 · 1 comment
Labels
question Further information is requested

Comments

@Nereuxofficial
Copy link

I recently added this crate to my project to deal with the docker API and it works really well and has a lot of documentation, which is great!

However i noticed a weird difference in behaviour between the docker import command and importing using this crate. I have a fairly small container started using this command:

docker run -d --name looper busybox /bin/sh -c 'i=0; while true; do echo $i; i=$(expr $i + 1); sleep 1; done'

and created an image for it using docker export(also works via the crate fine in my testing).

However importing the archive fails with this error, which indicates a missing file:

called `Result::unwrap()` on an `Err` value: DockerStreamError { error: "open /home/bene/.local/share/docker/tmp/docker-import-1868653418/bin/json: no such file or directory" }

This file is not present in the archive as far as i can see, however importing it using docker import works just fine. Now it may well be that this bug is due to a mistake I've made during the implementation but i could not yet find it so any help would be appreciated :)

I have created a reproduction example in a fork of this repo, which also has an example file to import it. Running it should be as simple as:

git clone https://github.com/Nereuxofficial/bollard
git checkout import_bug
cargo r --example import_image

And via docker:

docker import looper.tar.gz

On another note i also noticed that the example code for importing is incorrect and errors out with an EOF error, probably due to only parsing the first chunk. I will later create a PR for that if it is something that should be fixed.

@fussybeaver
Copy link
Owner

It looks like the looper tarball was created with container_export or the docker container export command, which is not the same as the image export facility. The former exports the FS, while the latter is exporting the image and related metadata..

@fussybeaver fussybeaver added the question Further information is requested label Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants