Keep containers running
walkero-gr opened this issue · 6 comments
I would like to ask if it is possible, to add an ENVIRONMENT variable to keep the containers running when someone starts them. This will be useful when used with docker-compose.yml files.
Explain what you intend to do! Why do you need to keep it running in the background when you're not using it?
As it is right now, the entrypoint executes whatever script you adds as a command in docker-compose. so you could put something to keep it alive there, like some command that waits for a keyboard input or something.
I did it like this so it would be useful in any sort of situation.
Like, you can execute make directly when initiating the container:
docker run --rm \
-v ${PWD}:/work \
-it amigadev/crosstools:m68k-amigaos make
That's really good, but if you would like to use more configurations, like ENV variables or more volumes, the executable line will be huge. The usage of docker-compose yml files solve that issue. Ad at the end someone would something like
docker-compose exec crossdev make
Exactly what kind of env variables do you want? All this is already possible.
@walkero-gr not sure If I understood correctly what you mean, but could this of any help?
https://docs.docker.com/compose/environment-variables/
You can tailor your compose file to your needs.
@apiraino Those environment variables are what I proposed. But they do not have any effect if they are not used by the containers. What I proposed is a way to keep the containers live, if the user want's that.
You already can, as stated before. What you want to do is already possible.