Z
Z
zlodiak2019-06-18 11:14:53
Nginx
zlodiak, 2019-06-18 11:14:53

Why is the docker container not displaying the page?

Using the simplest tutorial , I'm trying to make an html page accessible in the browser. I use nginx:alpine as a server.
Hands create html-page. In the same directory I create a Dockerfile:
FROM nginx:alpine
COPY . /usr/share/nginx/html
build like this:

/nginx $ docker build -t webserver-image:v1 .
Sending build context to Docker daemon  3.584kB
Step 1/2 : FROM nginx:alpine
 ---> bfba26ca350c
Step 2/2 : COPY . /usr/share/nginx/html
 ---> b54c91e64bfc
Successfully built b54c91e64bfc
Successfully tagged webserver-image:v1

The image is created without errors:
docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
webserver-image     v1                  b54c91e64bfc        16 seconds ago      20.5MB

The problem is that I can not view this page through the browser:
[email protected] ~/python/nginx $ docker run -d -p 80:80 webserver-image:v1
a672d7837f64a95d41815fc8ab931870fc2545d6118987bb173c798e049e2ea7
docker: Error response from daemon: driver failed programming external connectivity on endpoint wizardly_hermann (aa134f246786be398ba332286db88d73f04f5d1047996420eddb5c91282f8ce5): Error starting userland proxy: listen tcp 0.0.0.0:80: listen: address already in use.
[email protected] ~/python/nginx $ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
[email protected] ~/python/nginx $ docker run -d -p 8000:8000 webserver-image:v1
af08f8ef18e1fb06fe190612c20b89430eeadd8e0d42184f65483616c7bb938e
[email protected] ~/python/nginx $ curl docker
curl: (6) Could not resolve host: docker
[email protected] ~/python/nginx $ curl localhost:8000
curl: (56) Recv failure: Соединение разорвано другой стороной

Please help me understand what is wrong

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrew, 2019-06-18
@zlodiak

error response from daemon
Something went wrong.
docker run hello-worldstarts?
docker run -d -p 80:80 webserver-image:v1here 80 port
curl localhost:8000here 8000 port
docker run -d -p 8000:80 webserver-image:v1

S
Stanislav Pugachev, 2019-06-18
@Stqs

zlodiak ,
no offense but your actions are reminiscent of convulsive haphazard attempts to guess the password to some lock
why do you first try port -p 80:80 and then try -p 8000:8000? where is the logic? are you trying to pick a port randomly? don't you know/understand which port you need?
the same next
$ curl docker
curl: (6) Could not resolve host: docker
$ curl localhost:8000
curl: (56) Recv failure: Connection terminated by other side
are you trying to randomly guess what exactly can be given as an argument to curl in order to get a response?
let's go in order the
image you have collected
next you are trying to run the container

$ docker run -d -p 80:80 webserver-image:v1
a672d7837f64a95d41815fc8ab931870fc2545d6118987bb173c798e049e2ea7
docker: the Error response from daemon: driver failed The programming external connectivity applications on endpoint of wizardly_hermann (aa134f246786be398ba332286db88d73f04f5d1047996420eddb5c91282f8ce5): the Error starting userland proxy: the listen 0.0.0.0:80 the tcp: the listen: address already in use.
what exactly is unclear here? there is google translate in the end
until we understand what exactly is not clear to you here - there is no point in moving further

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question