containers / podlet

Generate Podman Quadlet files from a Podman command, compose file, or existing object
https://crates.io/crates/podlet
Mozilla Public License 2.0
422 stars 12 forks source link

Podman command not found when using podlet from container #54

Closed DevDorrejo closed 7 months ago

DevDorrejo commented 8 months ago

Hello,

I am trying to create a quadlet of a grafana container i have with podlet with the next command:

podman run --rm 
-v $PWD:$PWD 
-v $HOME/.config/containers/systemd/:/usr/share/containers/systemd/ 
-v /run/user/$(id -u)/podman/podman.sock:/run/podman/podman.sock 
-w $PWD 
--pull=newer 
docker.io/k9withabone/podlet generate container grafana

But i am getting this error:

Error: 
0: error getting command used to create container: grafana
1: error running `podman container inspect grafana`
2: No such file or directory (os error 2)

Location:
src/cli/generate.rs:447

Note: ensure podman is installed and available on $PATH

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

RUST_BACKTRACE=full

Error: 
0: error getting command used to create container: grafana
1: error running `podman container inspect grafana`
2: No such file or directory (os error 2)

Location:
src/cli/generate.rs:447

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⋮ 2 frames hidden ⋮                               
3: podlet::cli::generate::ContainerParser::from_container::ha3f619ba0935a881
at <unknown source file>:<unknown line>
4: podlet::cli::Cli::try_into_files::hdff2cbc2ae71a282
at <unknown source file>:<unknown line>
5: podlet::cli::Cli::print_or_write_files::h9f116e868a5c7987
at <unknown source file>:<unknown line>
6: podlet::main::hb3af6589f549800c
at <unknown source file>:<unknown line>
7: std::sys_common::backtrace::__rust_begin_short_backtrace::h347388fdd78ce4f3
at <unknown source file>:<unknown line>
8: std::rt::lang_start::{{closure}}::h3b17ba5a192c40c8
at <unknown source file>:<unknown line>
9: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hf47534de04578a83
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ops/function.rs:284
10: std::panicking::try::do_call::he270afe99f162c7b
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:552
11: std::panicking::try::hc551f5c5a344ecad
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:516
12: std::panic::catch_unwind::h6790e138972db2df
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panic.rs:142
13: std::rt::lang_start_internal::{{closure}}::haa35f81c7641c384
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/rt.rs:148
14: std::panicking::try::do_call::h4e42cde918b15a44
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:552
15: std::panicking::try::hb3bfb1061a5e948b
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:516
16: std::panic::catch_unwind::h4789ec49cbf5f558
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panic.rs:142
17: std::rt::lang_start_internal::h141a6b3fc711a41c
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/rt.rs:148
18: std::rt::lang_start::hd59146b9fcc325f0
at <unknown source file>:<unknown line>

Note: ensure podman is installed and available on $PATH

What i am ignoring?

k9withabone commented 8 months ago

podlet generate doesn't work when using the podlet container.

What I am ignoring?

This bit from the error message:

Note: ensure podman is installed and available on $PATH

Podman is not installed within the podlet container. Even if it was, podlet generate still wouldn't work in this case because the container you are attempting to generate from is managed by podman outside the podlet container.

Hopefully that made sense :stuck_out_tongue_winking_eye: .

DevDorrejo commented 8 months ago

podlet generate doesn't work when using the podlet container.

What I am ignoring?

This bit from the error message:

Note: ensure podman is installed and available on $PATH

Podman is not installed within the podlet container. Even if it was, podlet generate still wouldn't work in this case because the container you are attempting to generate from is managed by podman outside the podlet container.

Hopefully that made sense 😜 .

Thanks for the response, but sharing the .sock, won't allow the inside of container find the container outside, if podman is installed in the container?

k9withabone commented 8 months ago

I think that would work. The podlet container is a from scratch contianer so you will have to create a new image and copy the podlet binary into it. It would also require using podman --remote which can enabled in containers.conf.

DevDorrejo commented 8 months ago

I think that would work. The podlet container is a from scratch contianer so you will have to create a new image and copy the podlet binary into it. It would also require using podman --remote which can enabled in containers.conf.

ok, thanks, when have time I will look into this, so when have the solution will contribute with a push.