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

Mini Programs use Mini Program Cloud to implement WeChat payment functions

Table of contents 1. Open WeChat Pay 1.1 Affiliat...

Two simple menu navigation bar examples

Menu bar example 1: Copy code The code is as foll...

Detailed explanation of BOM and DOM in JavaScript

Table of contents BOM (Browser Object Model) 1. W...

Resolving MySQL implicit conversion issues

1. Problem Description root@mysqldb 22:12: [xucl]...

Method of Vue component document generation tool library

Table of contents Parsing .vue files Extract docu...

A Preliminary Study on JSBridge in Javascript

Table of contents The origin of JSBridge The bidi...

WeChat Mini Program implements the likes service

This article shares the specific code for the WeC...

jQuery to achieve sliding stairs effect

This article shares the specific code of jQuery t...

CSS3 animation to achieve the effect of streamer button

In the process of learning CSS3, I found that man...

Tutorial on deploying the open source project Tcloud with Docker on CentOS8

1. Install Docker 1. I installed Centos7 in the v...

Implementation of formatting partitions and mounting in Centos7

Linux often encounters situations such as adding ...

What is flex and a detailed tutorial on flex layout syntax

Flex Layout Flex is the abbreviation of Flexible ...

A brief analysis of the configuration items of the Angular CLI release path

Preface Project release always requires packaging...

How to install docker on Linux system and log in to docker container through ssh

Note: I use Centos to install docker Step 1: Inst...