I am running a docker container using the docker run -it
flags to compile some programs there.
Whenever a error, keyboard interrupt, segfault arises inside the environment, I get kicked out of the docker environment.
What’s the reason for that behaviour? Is it something related to my setup or is it the default? I would like to change that since it is not too uncommon to get some errors while trying to develop something.
3
Answers
Do not terminate your process when error arises.
The main process that is running inside the container has terminated.
Yes and yes. It’s not really "default", it’s how it works.
So wrap your compilation process in a different process, so that your main process do not exit. Typically, with shell:
In docker, containers are ephemeral which mean is you can reach the container only on running state. Also remember that every container working as process on host system. If container is down, there will be no process which able to represent the container. If you would like to observe or fetch data for debug purpose, I can advice you to use volume then you can store debug files on shared disk space between container and host.
BR,
didn’t quite understand the scenario and what you are trying to develop through docker but may be you can try following:
and then do :
for retrieving container_id, user
docker ps