S
S
SierraMadre2018-05-27 15:41:59
linux
SierraMadre, 2018-05-27 15:41:59

Is it possible to open a port in a Dockerfile?

Good afternoon, ladies and gentlemen. There is one Dockerfile

FROM nginx:latest
VOLUME /home/user/folder/:/usr/share/nginx/html/
EXPOSE 80:80

After building the container, I run it with the docker run --name SOME_NAME -d IMAGE command. As I understand it, the container should start immediately with the forwarded port and currency. But when I enter the IP of the host in the browser, I get nothing. So, am I running the container correctly, or do I still need to specify ports and currencies when doing docker run ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
Ziggy Pop, 2018-05-27
@SierraMadre

From the documentation:
That is, there is nothing in the dockerfile about where ports are forwarded from the container and where volumes are mounted from. All this is specified when creating the container, since the infrastructure outside the container should not depend on the dockerfile.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question