The company site has moved into the site container from the nginx:alpine image, which is the nginx web server on Alpine Linux. The site must open on port 8080 of the server: port 80 is taken by another web server. Here too the docker commands go through sudo.
Check whether the container is running and open the site. "Start" launches site the way a colleague launched it.
Open the site from the container
Check whether the site container is running, then open the site on port 8080 of the server.
First, predict
The site container is running. What will curl print?
Now start the exercise, run the command and compare your prediction with the output.
site is Up in docker ps, yet curl to port 8080 of the server got Couldn't connect to server. Which of these is true?
-
docker psshowssitewith theUpstatus: the container's main process is running. -
There was no HTTP answer:
(7) Couldn't connect to servermeans the connection never opened. -
curl would wait for a dropped connection until a timeout, but the refusal came within a couple of milliseconds, which is how a port nobody listens on answers.
The container is running, but nothing accepts connections on port 8080 of the server.