Detailed explanation of docker command to backup linux system

Detailed explanation of docker command to backup linux system

tar backup system

sudo tar cvpzf backup.tgz --exclude=/proc --exclude=/mnt --exclude=/sys --exclude=/backup.tgz /

For more Linux backup methods, refer to https://www.jb51.net/article/151167.htm

Writing dockerfile

Create a new directory Dockerfile and edit the Dockerfile script in the Dockerfile directory to the following content:

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 needed

Import the backed up system files as a docker image

1. Create a new directory backup in the Dockerfile directory

2. Unzip the backed up tar file to the backup directory: tar xvpfz backup.tgz

3.sudo docker build -t centos/centos:7.0 .

Summarize

The above is a detailed explanation of the docker command to back up the Linux system. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

You may also be interested in:
  • Detailed explanation of how to copy and backup docker container data
  • Detailed explanation of psql database backup and recovery in docker
  • Docker uses the mysqldump command to back up and export mysql data in the project
  • Database backup in docker environment (postgresql, mysql) example code
  • How to use Docker containers to implement proxy forwarding and data backup
  • Detailed explanation of backup, recovery and migration of containers in Docker
  • Detailed explanation of Docker data backup and recovery process

<<:  In-depth understanding of javascript class array

>>:  Linux/Mac MySQL forgotten password command line method to change the password

Recommend

Docker Compose installation and usage steps

Table of contents 1. What is Docker Compose? 2. D...

How to solve the Docker container startup failure

Question: After the computer restarts, the mysql ...

How to build DockerHub yourself

The Docker Hub we used earlier is provided by Doc...

Significantly optimize the size of PNG images with CSS mask (recommended)

This article is welcome to be shared and aggregat...

Solve the problem of OpenLayers 3 loading vector map source

1. Vector Map Vector graphics use straight lines ...

Implementing simple tabs with js

Tab selection cards are used very frequently on r...

Detailed explanation of MySQL and Spring's autocommit

1 MySQL autocommit settings MySQL automatically c...

Example of implementing skeleton screen with Vue

Table of contents Skeleton screen use Vue archite...

Enabling or disabling GTID mode in MySQL online

Table of contents Basic Overview Enable GTID onli...

Mysql 5.7.18 Using MySQL proxies_priv to implement similar user group management

Use MySQL proxies_priv (simulated role) to implem...

How to use crontab to backup MySQL database regularly in Linux system

Use the system crontab to execute backup files re...

Element UI table realizes drop-down filtering function

This article example shares the specific code for...

Tutorial on installing Odoo14 from source code on Ubuntu 18.04

Table of contents Background of this series Overv...