Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
269 views
in Technique[技术] by (71.8m points)

Kubernetes Container Command to start an bash that does not stop

I would like to start a container with bash only. In other words, a bash that does not stop, i guess an interactive bash or shell .

So far when i put sommething like ["bash"] or ["bin/bash"] or simply bash, the container run and stop. Is there a way to start a bash that run continuously ?

EDIT1

So far the only way that works for me is to write:

command:
   - tail
   - -f
   - /dev/null

Edit2

My use case here is that i want to build a docker image simply to develop in it. So that image has all the tool i need to work.

Hence I wonder how such container should be start. I don't want to run any of the dev tool at start. I simply want the container to be available ready for someome to run the interactive shell at any time.

question from:https://stackoverflow.com/questions/65911593/kubernetes-container-command-to-start-an-bash-that-does-not-stop

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

you can try the sleep command in while loop.

command: ["/bin/sh"]
args: ["-c", "while true; do sleep 10;done"]

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...