Dockerfile镜像制作

FROM centos:7
RUN curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
RUN curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
RUN yum install nginx -y
RUN rm -fr /usr/share/nginx/html/index.html
RUN echo "kiloview" >/usr/share/nginx/html/index.html
#CMD nginx -g 'daemon off;'
CMD ["nginx","-g","daemon off;"]

yum install openssh-server -y
yum install initscripts -y
/usr/sbin/sshd-keygen
echo '123456' | passwd --stdin root


nginx
/usr/sbin/sshd
ps -ef

 

基础镜像制作1

1下载相关压缩包

wget https://mirrors.tuna.tsinghua.edu.cn/lxc-images/images/alpine/3.13/amd64/default/20220714_22%3A42/rootfs.tar.xz --no-check-certificate  
tar xf rootfs.tar.xz
tar zcvf /opt/+kiloview_linux.tar.gz .

2编写  vi dockerfile

FROM scratch

ADD kiloview_linux.tar.gz /

CMD ["/bin/sh"]

3镜像制作

docker build -t kiloview_linux:v1

  

  

posted @ 2022-07-30 10:30  攻城狮联盟  阅读(43)  评论(0)    收藏  举报