#复制百度首页到Dockerfile下
[root@web02 dockerfile]# cp /root/html/index.html .
#编辑Dockerfile文件
[root@web02 dockerfile]# vi Dockerfile
FROM docker.io/lihanbing/nginx:v1.12.2
ADD index.html /usr/share/nginx/html/index.html
EXPOSE 80
#构建Dockerfile文件
[root@web02 dockerfile]# docker build . -t lihanbing/nginx:v1.12.2_with_index_expose
#运行容器
[root@web02 dockerfile]# docker run --rm -d --name nginx123 -P lihanbing/nginx:v1.12.2_with_index_expose
[root@web02 dockerfile]# netstat -lnutp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1462/nginx: master
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1111/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1425/master
tcp6 0 0 :::32768 :::* LISTEN 22533/docker-proxy
tcp6 0 0 :::81 :::* LISTEN 17090/docker-proxy
tcp6 0 0 :::82 :::* LISTEN 17207/docker-proxy
tcp6 0 0 :::22 :::* LISTEN 1111/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1425/master
udp 0 0 127.0.0.1:323 0.0.0.0:* 705/chronyd
udp6 0 0 ::1:323 :::* 705/chronyd
#访问 http://10.4.7.4:32768/
dockerfile2
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 经常在网上收到“读书有没有用”、“提升自己要看些什么书”这类问题,每次我都会很认真地回答,因为对我来说,读书真的有...