1. There is a response to accessing the service in the container in the container. There is no response to accessing the container service in the host, but the host can access the welcome interface of the container nginx service. The screenshot is as follows:
Accessing the service in the container in the container responded:
The service in the sink host access container is not responding:
Without direct port access, you will get the welcome interface code of nginx service:
2. Since the service can be accessed in the container, the service is started; The host can access the nginx welcome interface in the container, indicating that the host can access the 80-port service in the container. What is the problem?
Each mirror defines an interface that can be provided to the outside world. Nginx mirror only provides ports 80 and 443 by default. Naturally, you cannot access port 8080 in the container.
All you need to do is
docker createOr ..
docker runCarried When Creating Containers
--exposeParameter, the specified port can be opened.
--expose Expose a port or a range of ports