Closed jpsenior closed 3 years ago
I add it to mine.
Are you disconnecting with ctrl-p ctrl-q?
It is expected that if you start the server manually from within the container and then disconnect that the server stops. This is standard docker behavior and I am not going to change that. You should restart your server from outside the container and not start it from the inside except for debugging purposes.
The problem is when you drop into bash shell to debug something, or tweak a
file, then exit
, the container stops unexpectedly. No correct keyboard
sequence disconnects from the terminal in a way that does not stop the
container.
On Thu, Jan 14, 2021 at 11:19 PM Sandro notifications@github.com wrote:
It is expected that if you start the server manually from within the container and then disconnect that the server stops. This is standard docker behavior and I am not going to change that. You should restart your server from outside the container and not start it from the inside except for debugging purposes.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/factoriotools/factorio-docker/issues/353#issuecomment-760679345, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMLMMENR7QJ45UQRM33IYLSZ7NA3ANCNFSM4WB5E5ZA .
How did you open the shell?
docker-compose -d up
...
docker exec -ti
make change exit, ctrl+d, ctrl+z, etc... exits shell, stops container.
Workaround: set tty=true to docker-compose container.
On Fri, Jan 15, 2021 at 1:26 PM Sandro notifications@github.com wrote:
How did you open the shell?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/factoriotools/factorio-docker/issues/353#issuecomment-761180109, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMLMMEMHVKEGWNMSBX5CJ3S2CQIRANCNFSM4WB5E5ZA .
I tried to reproduce this with the following commands but the container continues to run.
Start the server:
sudo docker-compose up
exec in another terminal:
sudo docker exec --tty --interactive 11_factorio_1 bash
...do something...
exit
And the server continues to run.
Ok, execing a shell isn't attaching. So ignore the ctrl-p ctrl-q advice.
Adding the tty to the compose file is something you can do yourself, just as I do. But I agree with @SuperSandro2000 that it's not necessary for the project to include this.
Additional comment: including a shell command in containers is common but also not a best practice from a security standpoint. Execing a shell is convenient (I do it all the time for debugging) but it's actually the wrong way to do Docker.
Mount any directories or individual files you need to edit as volumes and then you can access them directly from the host OS.
I find when I docker attach to the docker-compose created factorio servers, the server disconnects when I disconnect from bash. I'm often in the bash shell to manage mods or edit files outside of the container namespace.
I am adding tty: true to my docker-compose.yml for 1.1 - Should this be part of the branch?