Answer the question
In order to leave comments, you need to log in
Dockerfile: why do you need EXPOS or VOLUME if you still need to forward ip or mount when starting a container?
I'm studying docker, and I ran into two questions:
1. The first question follows from the title of the question: why do we need EXPOS or VOLUME, if when starting the container you still need to forward ip or make a mount?
For example (in the example I omitted unnecessary moments):
FROM ubuntu:latest
RUN apt update && apt install -y nginx && apt install -y php-fpm
EXPOSE 80
Answer the question
In order to leave comments, you need to log in
https://docs.docker.com/engine/reference/builder/
The EXPOSE
instruction does not actually publish the port. It functions as a type of documentation between the person who builds the image and the person who runs the container, about which ports are intended to be published.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question