Docker Installation

Montreal

  1. Docker Installation

  1. Docker Registry Setup

Edit Docker Daemon Configuration:

sudo nano /etc/docker/daemon.json

Add or update the configuration:

{
  "insecure-registries": ["server-1.imagerie.user-vms.cqgc.hsj.rtss.qc.ca:5000"]
}

Restart Docker:

sudo systemctl restart docker

Verify Configuration:

sudo docker info | grep -i insecure

Make sure you are logged in to the registry on both VMs/nodes:

sudo docker login server-1.internal.imagerie.user-vms.cqgc.hsj.rtss.qc.ca:5051

Push the Docker Image to the Registry:

sudo docker tag scratch-for-setup:latest server-1.imagerie.user-vms.cqgc.hsj.rtss.qc.ca:5000/scratch-for-setup:latest
sudo docker push server-1.imagerie.user-vms.cqgc.hsj.rtss.qc.ca:5000/scratch-for-setup:latest
sudo docker build -t gitlab-runner -f Dockerfile-runner .
sudo docker tag gitlab-runner:latest server-1.imagerie.user-vms.cqgc.hsj.rtss.qc.ca:5000/gitlab-runner:latest
sudo docker push server-1.imagerie.user-vms.cqgc.hsj.rtss.qc.ca:5000/scratch-for-setup:latest

Note:

There is a script under stack/deploy called build_tag_push_images.sh which can be used to setup the registry.

Verify the Image in the Registry:

curl http://server-1.imagerie.user-vms.cqgc.hsj.rtss.qc.ca:5000/v2/_catalog

Pull the Docker Image from the Registry:

sudo docker pull server-1.imagerie.user-vms.cqgc.hsj.rtss.qc.ca:5000/scratch-for-setup:latest
sudo docker pull server-1.imagerie.user-vms.cqgc.hsj.rtss.qc.ca:5000/gitlab-runner:latest

##. Step 1: Verify the Image is Pushed to the Registry

List the repositories in your registry to ensure the image is there:

curl http://server-1.imagerie.user-vms.cqgc.hsj.rtss.qc.ca:5000/v2/_catalog

Step 2: Configure Docker to Access the Registry

If the registry requires authentication, log in to the registry (see above). Provide your username and password when prompted.

Pull the Image from the Registry: Pull the image to verify that it is accessible:

sudo docker pull server-1.imagerie.user-vms.cqgc.hsj.rtss.qc.ca:5000/scratch-for-setup:latest Example Commands and Expected Outputs Tag the Image for the Registry:

sh Copy code sudo docker tag scratch-for-setup:latest server-1.imagerie.user-vms.cqgc.hsj.rtss.qc.ca:5000/scratch-for-setup:latest Push the Image to the Registry:

sh Copy code sudo docker push server-1.imagerie.user-vms.cqgc.hsj.rtss.qc.ca:5000/scratch-for-setup:latest Expected output should show the layers being pushed successfully.

Verify the Image in the Registry:

sh Copy code curl http://server-1.imagerie.user-vms.cqgc.hsj.rtss.qc.ca:5000/v2/_catalog Expected output:

json Copy code {“repositories”:[“scratch-for-setup”]} Log in to the Registry:

sh Copy code sudo docker login server-1.imagerie.user-vms.cqgc.hsj.rtss.qc.ca:5000 Provide credentials when prompted.

  1. Pull the Image from the Registry:

sudo docker pull server-1.imagerie.user-vms.cqgc.hsj.rtss.qc.ca:5000/scratch-for-setup:latest Expected output should show the layers being pulled successfully.

Calgary