Simply use the dev container's postStartCommand configuration to automatically start the nginx and php services after opening a project in the vscode dev container, avoiding the need to manually execute commands to start them each time we reopen the workspace.
For more details:
The value of postStartCommand will be wrapped into /bin/sh -c ${postStartCommand}, so simply filling start or start & is not work, and the process may exit early before both nginx and php are started.
The start script itself does not produce any output, we can feel ease to redirect its stdout to null, avoiding the creation of nohup.out.
Though the postStartCommand can be passed with an array of commands, for scalability, I keep the start script to execute all necessary tasks.
Simply use the dev container's
postStartCommand
configuration to automatically start the nginx and php services after opening a project in the vscode dev container, avoiding the need to manually execute commands to start them each time we reopen the workspace.For more details:
postStartCommand
will be wrapped into/bin/sh -c ${postStartCommand}
, so simply fillingstart
orstart &
is not work, and the process may exit early before both nginx and php are started.start
script itself does not produce any output, we can feel ease to redirect its stdout to null, avoiding the creation ofnohup.out
.postStartCommand
can be passed with an array of commands, for scalability, I keep thestart
script to execute all necessary tasks.