Docker18:创建Centos

Docker18:创建Centos

Created
Nov 17, 2021 02:55 AM
Last Edited
Last updated December 2, 2021
Tags

1. 创建一个自己的centos

1.1 编写Dockerfile文件

  • 安装vim
  • net-tools
FROM centos MAINTAINER henggao<genghenggao@outlook.com> ENV MYPATH /usr/local WORKDIR $MYPATH RUN yum -y install vim RUN yum -y install net-tools EXPOSE 80 CMD echo $MYPATH CMD echo"------end------" CMD /bin/bash

1.2 构建

  • 🚩注意最后.
# docker build -f henggao-centos -t mycentos:1.0 . root@docker:/home/dockerfile# docker build -f henggao-centos -t mycentos:1.0 .

1.3 查看

notion image

1.4 测试运行

root@docker:/home/dockerfile# docker run -it mycentos:1.0 # 测试命令 [root@150b5a40acfd local]# pwd /usr/local [root@150b5a40acfd local]# ifconfig
 

1.5 查看镜像制作历史

root@docker:/home/dockerfile# docker history 06b45461b474
notion image