vipsoft

1. 创建 Dockerfile 文件、index.html测试页面

[root@localhost docker]# vi Dockerfile

FROM nginx:1.17.6  #基于 nginx 1.17,在build 时,会自动pull 一个 1.17.6 版本的 nginx

ENV LANG en_US.UTF-8 #设置环境变量

ADD index.html /usr/share/nginx/html  将本地的index.html添加到镜像中

EXPOSE 80  #开放 80 端口
EXPOSE 443 #开放 443 端口

[root@localhost docker]# vi index.html
Hello K8S

 

 编译 docker

[root@localhost docker]# docker build . -t hello-k8s:0.0.1

 

  run docker 镜像

[root@localhost docker]# docker run -d --name hello7001 -p 7001:80 hello-k8s:0.0.1

 

 

 

分类:

技术点:

相关文章:

  • 2021-11-06
  • 2021-09-06
  • 2021-12-30
  • 2021-12-23
猜你喜欢
  • 2021-08-21
  • 2021-11-28
  • 2021-10-13
  • 2021-06-24
  • 2021-10-28
  • 2021-09-19
  • 2021-08-07
相关资源
相似解决方案