RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* && sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
#yum clean all 是为了节省空间
RUN yum makecache && yum -y install net-tools && yum -y install vim && yum clean all
WORKDIR $test_dir
RUN echo ----------Success------------
# 选择默认的shell为bash shell
CMD ["/bin/bash"]
保存退出后,运行Dockerfile
cd /test
docker build -t zs_centos:0.0.1 .
然后运行容器,并添加容器卷
docker run -it -v /test:/test --privileged=true 7611bfc76047 /bin/bash