Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to clean the docker private server image regularly

Shulou Source: shulou.com Published: 2022-06-01 20:50:52 10月25日 Update

How to clean the docker private server image regularly? Many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can gain something.

download

Wget https://s3.eu-west-2.amazonaws.com/nexus-cli/1.0.0-beta/linux/nexus-clichmod + x nexus-cli

Configuration

. / nexus-cli configure

A. credentials file will eventually be created in this directory

# Nexus Credentialsnexus_host = "http://nexus.demo.com"nexus_username =" admin "nexus_password =" adminpass "nexus_repository =" your-docker-private-repo "

Note that the host and port of nexus entered by host are not the ports of repo corresponding to docker.

Nexus_repository is the repo corresponding to docker.

View Mirror

. / nexus-cli image ls

Keep the last 5

. / nexus-cli image delete-name mlabouardy/nginx-keep 5

Comprehensive script

Clean.sh

Image_file=image.txtCLI_HOME=/data/nexus3KEEP_VERSION_NUM=5 $CLI_HOME/nexus-cli image ls > $image_filesed-I'$d' $image_filecat $image_file | while read linedo echo "Clean $line" $CLI_HOME/nexus-cli image delete-name $line-keep $KEEP_VERSION_NUMdone

Scheduled task

Crontab-e0 2 * sh / data/nexus3/clean.sh is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Tags: Mirrors ports help private servers clarity tasks content that is documents articles novices more directories knowledge scripts industry information information channels puzzles Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Redmi Huawei MySQL Shulou Technology