Trouble stopping a Podman container when using Bash as the entrypoint
Linux - ContainersThis forum is for the discussion of all topics relating to Linux containers. Docker, LXC, LXD, runC, containerd, CoreOS, Kubernetes, Mesos, rkt, and all other Linux container platforms are welcome.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Trouble stopping a Podman container when using Bash as the entrypoint
Hello,
I'm new to Podman, and I'm trying to create an image. Everything works fine, except gracefully stopping the container when I'm done with it. The image is based on Debian, and I want the entrypoint to be the Bash shell. If I attach to the container and then use the exit command when I'm done with it, the shell exits and the container stops. However, if I try to just stop the container using "podman stop", the shell does not exit, and Podman eventually kills it.
I don't have any issue with attaching to the shell and exiting each time, but this problem does tell me that I'm doing something incorrectly, and I'd like to figure out what it is. This is the relevant portion of my Dockerfile:
ENTRYPOINT ["/bin/bash"]
CMD ["--login"]
I've also tried using Tini, as suggested by ChatGPT:
ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["/bin/bash", "--login"]
Neither of these solutions work. I assume that Bash just doesn't respond to the stop signal properly. I was hoping someone here might know of a way that I can resolve this. I like having Bash as my entrypoint, because my image needs to do a few different things, and I'd rather not be limited to one specific function as the entrypoint.
I'm new to Podman, and I'm trying to create an image. Everything works fine, except gracefully stopping the container when I'm done with it. The image is based on Debian, and I want the entrypoint to be the Bash shell. If I attach to the container and then use the exit command when I'm done with it, the shell exits and the container stops. However, if I try to just stop the container using "podman stop", the shell does not exit, and Podman eventually kills it.
Yes, if you don't exit podman will kill it. That is the way how does it work. podman cannot exit your shell instead of you.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.