Skip to main content

Moving Docker images from GitLab to Harbor

Since the GitLab Docker registry will be deprecated soon (end of 2024), we have to move all our images to the new Docker registry: https://savannah.ornl.gov

Steps to move images that are auto-generated via GitLab

  1. Create an issue in GitLab, and call it "Move images to Harbor".
  2. Create a new branch of your repository for that issue.
  3. Edit the .gitlab-ci.yml file and replace ${NDIP_DOCKER_REPOSITORY}/${CI_PROJECT_PATH} with ${NDIP_DOCKER_REPOSITORY}/${CI_PROJECT_PATH} (normally, there will be one change for a variable called IMAGE_NAME, but you should double-check).
  4. If you are pushing an image with each commit (for testing purposes, to "pass" image between GitLab stages, etc.), using tag $CI_COMMIT_SHORT_SHA, please add the build prefix to this tag (i.e. build-$CI_COMMIT_SHORT_SHA) so that we can later easily clean it up in the registry.
  5. Change the docker login line from the .gitlab-ci.yml file to
docker login -u $NDIP_DOCKER_USER -p $NDIP_DOCKER_PASSWORD $NDIP_DOCKER_REPOSITORY
  1. Create an MR for your changes, merge it, and trigger the pipeline to build an image. Make sure it succeeds.
  2. Check that you can pull the image. The path will be docker pull savannah.ornl.gov/ndip/<your project name>:<your image tag>.
info

See our project template for examples.

Steps to move images that were pushed to GitLab manually

If you have an image that is not auto-generated but was just pushed to GitLab once (e.g., some 3rd party image), you can manually move it to Harbor.

  1. Log in once (if you haven't done that yet) to https://savannah.ornl.gov/
  2. Ask the NDIP team (e.g., using a Slack channel) to add you to our NDIP project there.
  3. Pull your image from GitLab, for example:
        docker pull savannah.ornl.gov/ndip/tool-sources/generic/novnc-base:0.1
  4. Make a new tag for your image. Use the savannah.ornl.gov/ndip/common prefix, followed by your image name and tag:
        docker tag savannah.ornl.gov/ndip/tool-sources/generic/novnc-base:0.1 savannah.ornl.gov/ndip/common/novnc-base:0.1
  5. Log in to Savannah. You'll have to provide your credentials (email and CLI secret, which you can get from the Harbor GUI - top right, click on your email -> User Profile):
        docker login savannah.ornl.gov/ndip/common/novnc-base:0.1
  6. Push that image:
        docker push savannah.ornl.gov/ndip/common/novnc-base:0.1

Moving images that are available in DockerHub

If an image is available in DockerHub, there is no need to push it to savannah.ornl.gov/ndip/common, just add prefix regproxy.ornl.gov/hub_proxy/ to the image name, e.g. regproxy.ornl.gov/hub_proxy/node:22.9.0-alpine3.20 for image node:22.9.0-alpine3.20 and you can use it in your code. This should solve the problem with too many pulls from DockerHub. See here for more information.

Updating the repositories that use Docker images

After you've migrated a Docker image from GitLab to Harbor, please update all the repositories where this image is used. This can be:

The easiest way to find out where the image is used is to search for the old image name in NDIP GitLab Group (click on Search or go to... on the top left panel).