Revert the changes made by running the "run.sh clear" command to clear the Docker cache
book
Article ID: 325365
calendar_today
Updated On:
Products
VMware Telco Cloud Automation
Issue/Introduction
The TCA airgap server provides an optional clear function to the run.sh script that allows users to clear the Docker cache. The clear function performs the following tasks:
Removes all unused docker images This operation runs docker image prune to delete to clear the unused images. All images, excuding harbor images, will be deleted. Note: After the pruning has completed, the server will reach out to pull goharbor/prepare from jfrog again. It is then expected behavior for the clear function to fail in an internet-restricted (airgapped) environment.
Migrates all docker files All files under the /docker directory will be moved to the /data/docker folder, the "/var/lib/docker" symlink pointing to /docker will be deleted, and the symlink pointing to /data/docker folder under /var/lib will be recreated.
Unmounts the /docker partition/disk
Removes the docker auto mounts from the /etc/fstab file.
This KB provides the steps to revert the changes made by running the run.sh clear command.
Note: The pruning of the images is not reversable. All missing images will need to be pulled anew.
Environment
2.x
Resolution
The below example below is based on TCA 2.3 airgap server (default settings) that was set up to use a multi-disk schema. A single disk schema follows the same steps but with a different partition name.
Ensure the original docker disk is available: fdisk -l
Mount the docker disk to /docker folder: mount /dev/sdd1 /docker/
Stop the docker and harbor services systemctl stop harbor systemctl stop docker
Check and delete the docker cache soft link in /var/lib: ls -l /var/lib/ rm /var/lib/docker
Re-link the docker cache soft link to the /docker folder: ln -s /docker /var/lib/ ls -l /var/lib/
Move all the sdocker cache file to the /docker folder: mv /data/docker/* /docker/
Start the docker service and confirm is running: systemctl start docker systemctl status docker
Check the docker images: docker images
Start the harbor service: systemctl start harbor systemctl status harbor cd /opt/harbor docker-compose ps
Add the /docker auto mount to the /etc/fstab file: vi /etc/fstab