LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Containers
User Name
Password
Linux - Containers This 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


Reply
  Search this Thread
Old 05-29-2023, 03:57 AM   #1
Mermohn
LQ Newbie
 
Registered: Nov 2021
Posts: 4

Rep: Reputation: Disabled
Question 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.


Thanks.
 
Old 05-30-2023, 05:59 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,830

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
Quote:
Originally Posted by Mermohn View Post
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.
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Can't run rootless container using podman? shanebagel Linux - Newbie 5 08-03-2022 03:14 PM
LXer: Podman Compose or Docker Compose: Which should you use in Podman? LXer Syndicated Linux News 0 06-18-2022 04:48 PM
LXer: Podman Tutorial – Get Started With Podman LXer Syndicated Linux News 0 08-06-2021 11:39 PM
LXer: What Is Podman And How To Install Podman In Linux LXer Syndicated Linux News 0 08-01-2021 03:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Containers

All times are GMT -5. The time now is 05:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration