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

Don't panic if docker version cannot be parsed #298

Closed
davidgraeff opened this issue Sep 3, 2019 · 8 comments
Closed

Don't panic if docker version cannot be parsed #298

davidgraeff opened this issue Sep 3, 2019 · 8 comments
Labels
A-container-engine Area: container engines A-podman Area: podman container engine enhancement

Comments

@davidgraeff
Copy link

davidgraeff commented Sep 3, 2019

I'm using podman instead of Docker (podman has a docker cli interface).
But podman, because it works daemonless, correctly reports no "Server API Version":

Version:            1.5.1
RemoteAPI Version:  1
Go Version:         go1.12.7
OS/Arch:            linux/amd64

A less intrusive version check that just warns would work as well, wouldn't it?

See
https://github.com/rust-embedded/cross/blob/e1470782db43fc737cf9b7f14748331228b8229d/src/docker.rs#L26

Thanks

@reitermarkus
Copy link
Member

Can you submit a PR?

@davidgraeff
Copy link
Author

Sure

@oblitum
Copy link

oblitum commented Oct 14, 2019

Would be nice to have official/direct support for podman, it's the simplest solution for running containers rootless, daemonless and safely (without being part of high privileged user groups). I suppose that to use it now one has to provide a docker command that redirects to podman, but still not working due to this issue.

@davidgraeff
Copy link
Author

davidgraeff commented Oct 15, 2019

It's not that easy unfortunately. That's why I haven't submitted a patch yet.
Try it out on your machine with this wrapper script:

#!/bin/sh
if [ "$1" == "version" ] && [ "$2" == "--format={{.Server.APIVersion}}" ]; then
echo "100.0"
else
echo "Executing $@"
/usr/bin/podman "$@"
fi

On my fedora system SELinux restricts the container to a degree that nothing works. Disabling SELinux fails with a user-id mapping. The docker daemon does work different than podman in this situation.

@oblitum
Copy link

oblitum commented Oct 15, 2019

It works on ArchLinux, but needs some fixes. First, your wrapper worked for the image to be pulled, but then what cross executes afterwards cause errors:

❯ cross build --release --locked --target armv7-unknown-linux-gnueabihf
Executing run --userns host --rm --user 1000:1000 -e XARGO_HOME=/xargo -e CARGO_HOME=/cargo -e CARGO_TARGET_DIR=/target -e USER=francisco -e CROSS_RUNNER= -v /home/francisco/.xargo:/xargo:Z -v /home/francisco/.cargo:/cargo:Z -v /cargo/bin -v /home/francisco/Projects/samples/rust:/project:Z,ro -v /home/francisco/.rustup/toolchains/stable-x86_64-unknown-linux-gnu:/rust:Z,ro -v /home/francisco/Projects/samples/rust/target:/target:Z -w /project -i -t rustembedded/cross:armv7-unknown-linux-gnueabihf-0.1.16 sh -c PATH=$PATH:/rust/bin "cargo" "build" "--release" "--locked" "--target" "armv7-unknown-linux-gnueabihf"
Trying to pull docker.io/rustembedded/cross:armv7-unknown-linux-gnueabihf-0.1.16...
Getting image source signatures
Copying blob 515c9bb51536 done
Copying blob e1eabe0537eb done
Copying blob a7344f52cb74 done
Copying blob 98505a711ed1 done
Copying blob 8b6c268f7510 done
Copying blob 4701f1215c13 done
Copying blob 275d3fe1c097 done
Copying blob 21ff9fc78e04 done
Copying blob 1eec613d2471 done
Copying blob 175c081af4db done
Copying blob dc06501142e1 done
Copying blob 5a611f0c211d done
Copying blob 8b6856ffd086 done
Copying blob 84b6f835981a done
Copying blob 95eb8b4a29a6 done
Copying blob 5260dade96c9 done
Copying blob 22b1b0355cbc done
Copying blob 5d7f653b916d done
Copying blob c6d39e7d7bff done
Copying config 3b6c20b612 done
Writing manifest to image destination
Storing signatures
Error: error checking path "/cargo/bin": stat /cargo/bin: no such file or directory

So I executed the command manually with a few edits and the project built:

❯ podman run --userns host --rm -e XARGO_HOME=/xargo -e CARGO_HOME=/cargo -e CARGO_TARGET_DIR=/target -e USER=francisco -e CROSS_RUNNER= -v /home/francisco/.xargo:/xargo:Z -v /home/francisco/.cargo:/cargo:Z -v /home/francisco/Projects/samples/rust:/project:Z -v /home/francisco/.rustup/toolchains/stable-x86_64-unknown-linux-gnu:/rust:Z,ro -v /home/francisco/Projects/samples/rust/target:/target:Z -w /project -i -t rustembedded/cross:armv7-unknown-linux-gnueabihf-0.1.16 sh -c 'PATH=$PATH:/rust/bin cargo build --release --target armv7-unknown-linux-gnueabihf'
   Compiling sample v0.1.0 (/project)
    Finished release [optimized] target(s) in 0.37s

@oblitum
Copy link

oblitum commented Oct 15, 2019

This is my subgid/subuid setup for rootless podman:

❯ cat /etc/subgid /etc/subuid /proc/self/uid_map
francisco:100000:65536
francisco:100000:65536
         0          0 4294967295

❯ podman unshare cat /proc/self/uid_map
         0       1000          1
         1     100000      65536

@reitermarkus
Copy link
Member

reitermarkus commented Oct 15, 2019

I think we could just bump the requirement and assume that Docker supports the --userns flag since the next release will be a breaking change anyways.

@reitermarkus
Copy link
Member

reitermarkus commented Nov 15, 2019

Fixed by #344.

@Alexhuszagh Alexhuszagh added bug A-container-engine Area: container engines A-podman Area: podman container engine enhancement and removed bug labels Nov 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-container-engine Area: container engines A-podman Area: podman container engine enhancement
Projects
None yet
Development

No branches or pull requests

4 participants