docker Backup linux system command details
- 2020-12-19 21:23:26
- OfStack
tar backup system
sudo tar cvpzf backup.tgz --exclude=/proc --exclude=/mnt --exclude=/sys --exclude=/backup.tgz /
More linux backup method reference https: / / www ofstack. com article / 151167. htm
Write dockerflie
Create a new directory Dockerfile and edit the Dockerfile script under Dockerfile, as follows:
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
Change username and password as appropriate
Import the backup system files as docker images
1. Create a new directory backup under Dockerfile
2. Unzip the backup tar file to backup directory: tar xvpfz backup.tgz
3.sudo docker build -t centos/centos:7.0 .
conclusion