-d: Run the container in the background and return the container ID; -i: Run the container in interactive mode, usually used with -t; -t: reallocate a pseudo input terminal for the container, usually used together with -i; Additional knowledge: docker-compose starts nginx through sh command and the container automatically exits with code 0 In the template file used by docker-compose, the container is started automatically by executing the sh command through the entrypoint or command parameter to start the nginx service, but the container automatically exits after docker-compose up
Reason: Docker's mechanism is to run the container in the background. There must be at least one foreground process. If the command run by the container is not a command that has been suspended (such as running top, tail), it will automatically exit. Solution: You can use the sh command containing the -g "daemon off;" configuration item to start the nginx service in the foreground mode.
If the container needs to start multiple processes at the same time, just suspend one of them to the foreground, for example:
or
The above article "The status is always Exited after docker run" is all the content that the editor shared with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Solve the problem that MySQL read-write separation causes data not to be selected after insert
>>: Solve the mobile terminal jump problem (CSS transition, target pseudo-class)
Preface In Windows, you can start multiple MySQL ...
Perform the following operations in the Ubuntu co...
Route Jump this.$router.push('/course'); ...
Table of contents 1. Problems encountered 2. Idea...
Linux version upgrade: 1. First, confirm that the...
A very useful function group_concat(), the manual...
1. Linux under VMware Workstation: 1. Update sour...
<p><b>This is bold font</b></...
Table of contents Preface 1. Download MySQL from ...
When a company developer executes an insert state...
<br />Previous Web Design Tutorial: Web Desi...
Table of contents Typical waterfall website Water...
introduction Sometimes, if there are a large numb...
Several parts of Compose deal with environment va...
Scenario Requirements 1. We can use the script fu...