Revert the changes made by running the "run.sh clear" command to clear the Docker cache
search cancel

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:

  1. 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.
  2. 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.
  3. Unmounts the /docker partition/disk
  4. 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.
 

  1. Ensure the original docker disk is available:
    fdisk -l
  2. Mount the docker disk to /docker folder:
    mount /dev/sdd1 /docker/
  3. Stop the docker and harbor services
    systemctl stop harbor
    systemctl stop docker
  4. Check and delete the docker cache soft link in /var/lib:
    ls -l /var/lib/
    rm /var/lib/docker
  5. Re-link the docker cache soft link to the /docker folder:
    ln -s /docker /var/lib/
    ls -l /var/lib/
  6. Move all the sdocker cache file to the /docker folder:
    mv /data/docker/* /docker/
  7. Start the docker service and confirm is running:
    systemctl start docker
    systemctl status docker
  8. Check the docker images:
    docker images
  9. Start the harbor service:
    systemctl start harbor
    systemctl status harbor
    cd /opt/harbor
    docker-compose ps
  10. Add the /docker auto mount to the /etc/fstab file:
    vi /etc/fstab
    #system mnt-pt type options dump fsck
    PARTUUID=########-####-####-####-############ / ext4 defaults,barrier,noatime,noacl,data=ordered 1 1
    PARTUUID=########-####-####-####-############ /boot/efi vfat defaults 1 2
    /dev/cdrom /mnt/cdrom iso9660 ro,noauto 0 0
    # BEGIN ANSIBLE MANAGED BLOCK
    /dev/sdb1 /data ext4 defaults 0 0
    /dev/sdc1 /photon-reps ext4 defaults 0 0
    /dev/sdd1 /docker ext4 defaults 0 0                  #add docker auto mount
    # END ANSIBLE MANAGED BLOCK