Commands to execute background process in Docker CMD
Connecting to RDS Mysql from docker container with WordPress How to get client IP from request inside haproxy docker container? Difference between nodejs v0.12 and v5.x distributions How to quickly show policies of all docker containers Docker how to create container Docker: How to store images and metadata on another filesystem?
I would like to execute a shell command with a process running in background example
CMD [“sh”, “-c”, “mongod –dbpath /test &”]
One Solution collect form web for “Commands to execute background process in Docker CMD”
Besides the comments on your question that already pointed out a few things about Docker best practices you could anyway start a background process from within your
start.sh script and keep that
start.sh script itself in foreground using the
nohup command and the ampersand (
&). I did not try it with
mongod but something like the following in your
start.sh script could work:
#!/bin/sh ... nohup sh -c mongod --dbpath /test & ...