各位大虾好!小白我写了一个dockerfile,内容如下:
FROM ubuntu:14.04
MAINTAINER Chris Chan "chenx1242@163.com"
ENV REFRESHED_AT 2016-12-05
RUN apt-get -y update && apt-get install -y nginx
RUN mkdir -p /var/www/html/website
ADD nginx/global.conf /etc/nginx/conf.d/
ADD nginx/nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
然后又在本地写了一个index.html,然后启动这个镜像却发现port那里为空,请问大神们这样情况是什么原因呢?
EXPOSE refers to which ports are open and accessible to services within the same network. But it is not open to the host machine.
To see the port number in docker ps, you need to specify the -p or -P parameter when docker run, such as
-p 80:8080
Map port 8080 in the container to port 80 of the host.The PORTS of docker ps displays the
docker run -p
specified port mappingEXPOSE
means a port open to other containers (not external networks), and this is not displayed in docker ps.