Solve the problem of docker images disappearing

Solve the problem of docker images disappearing

1. Mirror images disappear in 50 and 93

[root@h50 /]# df -h
File system capacity used available used% Mount point devtmpfs 24G 0 24G 0% /dev
tmpfs 24G 0 24G 0% /dev/shm
tmpfs 24G 428M 24G 2% /run
tmpfs 24G 0 24G 0% /sys/fs/cgroup
/dev/mapper/cl-root 50G 43G 8.0G 85% /

Root remaining 85%

Overlay 50G 43G 8.0G

85% /var/lib/docker/overlay2/9e1d9bbd368c8ebafde39dcaaa66afecde95bfab7db51b13fe92aa5c7995cc9e/merged

The image uses the space under root

cat /var/lib/kubelet/config.yaml
evictionHard:
 imagefs.available: 15%
 memory.available: 100Mi
 nodefs.available: 10%
 nodefs.inodesFree: 5%

If imagesfs is less than 15%, it will be evicted

It should be related to this

Try to increase the hard disk space for root, divide the space from home to root

Add 7 t spaces on 93

Add space to root on lv

resize2fs /dev/mapper/centos-root Error occurred xfs_growfs /dev/mapper/centos-root

Data backup

scp -r /home/ [email protected]:/root/home50/*

Unmount

umount -l /home
lvextend -L +80g /dev/centos/root

After adding, xfs needs to be updated

xfs_growfs /dev/mapper/centos-root

Unable to mount, needs repair

xfs_repair /dev/cl/home

Due to several T, the repair time is too long

Delete lv home

lvremove /dev/centos/home

Create a 1.8t lv home

lvcreate -n home -L 1.9T /dev/centos

Format as xfs system

mkfs.xfs /dev/centos/home

Mount

mount /dev/mapper/centos-home /home

Recover data back

Increase home size

lvextend -L +1.8t /dev/centos/home
xfs_growfs /dev/mapper/cl-home

At this time, restore the home size

Recover data back

scp -r [email protected]:/root/home52/* /home/

2. Reduce

xfs does not support reduction, so lvreduce cannot be used. However, resize2fs cannot be used and an error will be reported: Couldn't find valid filesystem superblock. This means that the reduced logical partition needs to be reformatted using the mkfs.xfs command. If there are important files on this logical partition, it will be a disaster.

You can only back up the files under home.

Note: Mounting at boot

cat /etc/fstab

60 up

lvreduce -L 5t /dev/centos/home
lvextend -L +1.8t /dev/centos/root
xfs_growfs /dev/mapper/centos-home

Supplement: Docker restart image is gone_Docker common images and usage

As the most popular technology at the moment, Docker has increasingly become a necessary skill for developers. It allows us to quickly and easily build the required application environment, such as the commonly used redis, mq, tomcat, zookeeper, mysql, and nginx images. Here I summarize the usage methods so that you can link these knowledge points together in one article.

1. Pull the image

At present, I often use the domestic NetEase mirror, which has a very fast download speed.

# docker pull rabbitmq:3-management --This version has a background display and you can see the monitoring page

2. View the image

After pulling it down, check the image and get the image id:

# docker images ----- View the pulled image

3. Start the image

Starting the image is a critical step. The startup commands of different images are somewhat different, mainly the port mapping. The following images have been tested and can be successfully started:

# docker run -d --name "xdclass_nginx" -p 8088:80 nginx --Start nginx
# docker run -d --name "xdclass_rabbitmq" -p 5672:5672 -p 15672:15672 db695e07d0d
--Run mq; -d is background running; -p is to specify port mapping# docker run -d --name xdclass_redis -p 6379:6379 d4f259423416 --Start the redis container, but actually redis is not started# docker exec -it ce388f800aed redis-cli ---Access and start redis in docker, the container number is after it.
# docker run -d --name myzookeeper -p 2181:2181 --restart always 5e8e3d7b06f9 --Start the zookeeper image# docker run -p 3306:3306 --name mysql -v $PWD/conf:/etc/mysql/conf.d -v $PWD/logs:/logs -v $PWD/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=rootroot -d 9e64176cd8a2. ----docker starts mysql, the password after MYSQL_ROOT_PASSWORD is the default root password set at startup.

4. Check if the container has been started

# docker ps -a --- View all containers, including started and unstarted containers # docker ps. ----- View started containers.

5. Subsequent operations of Mysql

After the Mysql container is started, if you want to connect through a client such as Navicat, you also need to enable remote login permissions. Here are the steps:

The first step is to enter the container after starting the mysql container above:

# docker exec -it c8486ec93afb bash

Step 2: Log in to MySQL:

#mysql -u root -p ---You will be prompted to enter the password rootroot of the previous docker run;

Step 3: Add remote access permissions to MySQL:

mysql> grant all privileges on *.* to root@'%' identified by 'rootroot' with grant option;
mysql> flush privileges;

Note: The newly set remote access username: root, password: rootroot;

6. Stop and restart container commands

# docker stop 283138f62bc2 ---Stop the container, container number: 283138f62bc2
# docker start 283138f62bc2 --Start the created container number: 283138f62bc2
#docker stop $(docker ps -a -q) -- stop all containers

The above is my personal experience. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. If there are any mistakes or incomplete considerations, please feel free to correct me.

You may also be interested in:
  • Talk about the issue of replacing docker (shim) with containerd in kubernetes1.20
  • How to keep running after exiting Docker container
  • Docker removes abnormal container operations
  • Goodbye Docker: How to Transform to Containerd in 5 Minutes
  • Docker dynamically exposes ports to containers
  • Delete the image operation of none in docker images
  • Implementation of local migration of docker images
  • Docker image cannot be deleted Error: No such image: xxxxxx solution
  • How to delete an image in Docker
  • Naming containers and images in Docker

<<:  Web page layout should consider IE6 compatibility issues

>>:  JavaScript canvas to achieve scratch lottery example

Recommend

Docker implements container port binding local port

Today, I encountered a small problem that after s...

A brief discussion on HTML doctype and encoding

DOCTYPE Doctype is used to tell the browser which...

Use of vuex namespace

Table of contents Since Vuex uses a single state ...

How to cancel the background color of the a tag when it is clicked in H5

1. Cancel the blue color of the a tag when it is ...

CSS realizes div completely centered without setting height

Require The div under the body is vertically cent...

Historical Linux image processing and repair solutions

The ECS cloud server created by the historical Li...

Nginx solves cross-domain issues and embeds third-party pages

Table of contents Preface difficulty Cross-domain...

Detailed explanation of JavaScript's Set data structure

Table of contents 1. What is Set 2. Set Construct...

React example of how to get the value of the input box

React multiple ways to get the value of the input...

A brief discussion on the whole process of Vue's first rendering

Table of contents 1. Vue initialization vue entry...