Cannot operate services when a container is detached
See original GitHub issueI am maintaining a Docker image that utilizes dumb-init
to spawn processes.
Recently I found that I cannot manage services in docker container anymore.
This works well when a container is running in foreground.
docker run --rm -uroot -it attr/drupal-lemp service nginx stop
[ ok ] Stopping nginx: nginx.
However whey I use drush run -d
+ drush exec
it fails.
docker run --name=c1 -d attr/drupal-lemp && docker exec -uroot c1 service nginx stop
d4d38832ec1b896faa65631ba324b4bfb5335ddd0e4bfced3a8caab750c94142
Stopping nginx: nginx failed!
This might happen because the dumb-init
is started by unprivileged user with sudo.
I had to add sudo
there because Docker does not allow to set USER after CMD.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Troubleshoot disconnected Amazon ECS container instances ...
However, if your container agent remains in a disconnected state, then the container instance can't operate as part of your ECS cluster.
Read more >Docker Detached Mode Explained - freeCodeCamp
Detached mode, shown by the option --detach or -d , means that a Docker container runs in the background of your terminal.
Read more >docker container started in Detached mode stopped after ...
Run an infinite command in detached mode so the command never ends and the container never stops. I usually use "tail -f /dev/null"...
Read more >Docker Tutorials: Detached (-d) mode in Docker - Explained
It runs the container in the background of your terminal. It does not receive input or display output.
Read more >Cannot kill or detach a docker container using Ctrl-C or Ctrl
the container is not there (it has been terminated). If you type Control-P Control-Q instead of Control-C in the 2nd example, the container...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
You’ll want to use some sort of service manager such as
runit
/supervisord
Thanks, I’will take a look at runit.