You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The first line of the EXPOSE instruction explanation is missing part of the information.
The line below EXPOSE 80/udp states that we want to match the port exposed in our container with the one we have in src/index.js, but on the js file is 3000 and on the Dockerfile example provided it's 8000. Shouldn't it be the same?
EXPOSE instruction
EXPOSE specifies which ports the **<missing data>** when running the container. Each port is separated by a space ( ). By default the container listens using TCP, but UDP can be used by adding /udp after the port.
For example:
EXPOSE 80/udp
In our case, we want the port exposed by our container to match the port our application is running on (remember: const port = process.env.PORT || 3000 in src/index.js), therefore, we are publishing the value of our PORT environment variable.
ARG PORT=8000
ENV PORT=$PORT
...
EXPOSE $PORT
EXPOSE does not actually publish the port. When running the container with docker run, the -p flag needs to be used to access the port from your host machine. More on this in the next section. Learn more about EXPOSE
The text was updated successfully, but these errors were encountered:
EXPOSE 80/udp
states that we want to match the port exposed in our container with the one we have insrc/index.js
, but on the js file is3000
and on the Dockerfile example provided it's8000
. Shouldn't it be the same?The text was updated successfully, but these errors were encountered: