docker备份linux系统的命令详解
tar备份系统
sudo tar cvpzf backup.tgz --exclude=/proc --exclude=/mnt --exclude=/sys --exclude=/backup.tgz /
更多linux备份方法参考https://www.jb51.net/article/151167.htm
编写dockerflie
新建目录Dockerfile,在Dockerfile目录下编辑Dockerfile脚本,如下内容:
FROM scratch COPY rootfs / RUN chmod u+s /usr/bin/sudo RUN chmod u+s /usr/bin/passwd RUN chmod u+s /bin/su RUN chmod u+s /bin/ping RUN chmod u+s /bin/mount RUN chmod u+s /bin/umount USER root WORKDIR /home/root
根据情况修改用户名密码
将备份的系统文件导入为docker镜像
1.在Dockerfile目录下新建目录backup
2.将备份好的tar文件解压到backup目录下:tar xvpfz backup.tgz
3.sudo docker build -t centos/centos:7.0 .
总结
相关推荐
xysoul 2020-11-03
ShangQuan0 2020-09-10
fearlessxjdx 2020-09-04
王道革 2020-11-25
bwyyziq 2020-11-22
pigsmall 2020-11-19
changecan 2020-11-19
helloWorldAndYou 2020-11-16
nginxs 2020-11-14
红石丶 2020-11-13
WanKaShing 2020-11-12
yangkang 2020-11-12
滴水穿石点石成金 2020-11-12
张荣珍 2020-11-12
wuxunanjing 2020-11-11
魅惑青花瓷 2020-11-11
lihongtai 2020-11-09
yangkang 2020-11-09