You use docker-compose to manage the lifecycle of Harbor. This topic provides some useful commands. You must run the commands in the directory in which docker-compose.yml is located.

See the Docker Compose command-line reference for more information about docker-compose.

Stop Harbor

To stop Harbor, run the following command.

  1. sudo docker compose stop
  2. Stopping nginx ... done
  3. Stopping harbor-portal ... done
  4. Stopping harbor-jobservice ... done
  5. Stopping harbor-core ... done
  6. Stopping registry ... done
  7. Stopping redis ... done
  8. Stopping registryctl ... done
  9. Stopping harbor-db ... done
  10. Stopping harbor-log ... done

Restart Harbor

To restart Harbor, run the following command.

  1. sudo docker compose start
  2. Starting log ... done
  3. Starting registry ... done
  4. Starting registryctl ... done
  5. Starting postgresql ... done
  6. Starting core ... done
  7. Starting portal ... done
  8. Starting redis ... done
  9. Starting jobservice ... done
  10. Starting proxy ... done

Reconfigure Harbor

To reconfigure Harbor, perform the following steps.

  1. Stop Harbor.

    1. sudo docker compose down -v
  2. Update harbor.yml.

    1. vim harbor.yml
  3. Run the prepare script to populate the configuration.

    1. sudo ./prepare

    To reconfigure Harbor to install Trivy, include the component in the prepare command.

    1. sudo ./prepare --with-trivy
  4. Re-create and start the Harbor instance.

    1. sudo docker compose up -d

Other Commands

Remove Harbor’s containers but keep all of the image data and Harbor’s database files in the file system:

  1. sudo docker compose down -v

Remove the Harbor database and image data before performing a clean re-installation:

  1. rm -r /data/database
  2. rm -r /data/registry
  3. rm -r /data/redis