The docker run -d -p command is used to run the container, run it in daemon mode (-d) and map the port (-p), allowing external access to services within the container.
The meaning of docker run -d -p
docker run -d -p
The command is used to run the container in Docker and specifies the following parameters:
-d
: Run the container in daemon mode. After the container is started, it will run in the background, even if the terminal exits. stop. -p
: Port mapping, mapping the internal port of the container to the external port of the host so that the outside world can access the services in the container. Usage Example
The following is an example of using the docker run -d -p
command to run an Nginx container:
<code class="shell">docker run -d -p 80:80 nginx</code>
In this example:
-p 80:80
specifies that port 80 inside the container is mapped to port 80 outside the host. Parameter description
-p
The option is followed by two parameters, separated by a colon (:):
The above is the detailed content of docker run -d -p what does it mean. For more information, please follow other related articles on the PHP Chinese website!