@benswift Hey, so we can only use single image per job ? What if I want multiple images, is there a syntax for that ? I am thinking something like run_tests: image: [ubuntu:someothertag , node:image] stage: test script: - echo "woohoo, tests pass" Answer from OmarSherif96 on forum.gitlab.com
🌐
GitLab
docs.gitlab.com › gitlab docs › use gitlab › use ci/cd to build your application › ci/cd yaml syntax reference
CI/CD YAML syntax reference | GitLab Docs
It uses the default retry: 2, but ignores the default image and uses the image: ruby:2.7 defined in the job. ... Control inheritance of default keywords in jobs with inherit:default. Global defaults are not passed to downstream pipelines, which run independently of the upstream pipeline that triggered the downstream pipeline. Use include to include external YAML files in your CI/CD configuration. You can split one long .gitlab-ci.yml file into multiple files to increase readability, or reduce duplication of the same configuration in multiple places.
Discussions

.gitlab-ci.yaml use image with a specific user
Hi ! In the .gitlab-ci.yaml file, I need to use the keyword image to use a Docker image like this: zap: stage: dast* image: my-docker-image* The problem is that I don’t know how to specify the user to start the docker image with. In local, the command that I run to use the docker image is ... More on forum.gitlab.com
🌐 forum.gitlab.com
4
0
July 26, 2022
git - Multiple Docker images in .gitlab-ci.yml - Stack Overflow
Here is my problem setup with GitLab and its integrated CI service. I have a current GitLab 8.1. and a gitlabci-multi-runner (0.6.2) with Docker support. After extending the ubuntu:precise image to More on stackoverflow.com
🌐 stackoverflow.com
Use your own image on GitlabCI
Hello! This is my first post here, so apologies if I’m doing something wrong. I’m actually using Gitlab CI/CD with SaaS Runners. I am using public docker images, but I´m interested to use my own image, but I don’t want to upload to public registry. I have it uploaded on my own gitlab ... More on forum.gitlab.com
🌐 forum.gitlab.com
3
0
March 21, 2022
How to put multiple images in image keyword in gitlab-ci - Stack Overflow
Using the image and services keywords in your.gitlab-ci.yml file, you may define a GitLab CI/CD job that uses multiple Docker images. More on stackoverflow.com
🌐 stackoverflow.com
🌐
GitLab
forum.gitlab.com › gitlab ci/cd
Using different Docker images during a single Gitlab-CI job - GitLab CI/CD - GitLab Forum
January 18, 2019 - I’m facing a probably classical problem, but I don’t know how to deal with, mostly due to the reset during job switching. In my pipeline, I wish to run instrumented test and collect these data to display them on a dashboard (let’s call it SonarQube 😉 ) In order to do this, I would appreciate to use (at least) two distinct Docker environments: one with the build requirements (dependencies, compilers, etc.) one with the collector I wish to use two container images because there are really...
🌐
GitLab
forum.gitlab.com › gitlab ci/cd
.gitlab-ci.yaml use image with a specific user - GitLab CI/CD - GitLab Forum
July 26, 2022 - Hi ! In the .gitlab-ci.yaml file, I need to use the keyword image to use a Docker image like this: zap: stage: dast* image: my-docker-image* The problem is that I don’t know how to specify the user to start the dock…
🌐
Tangram Vision
tangramvision.com › blog › gitlab-ci-cd-recipes-updating-your-docker-image-automatically
Tangram Vision Blog | GitLab CI/CD Recipes: Updating Your Docker Image Automatically
September 14, 2022 - It doesn't sound complicated, but ... will have a handful of files that we primarily care about: 1. .gitlab-ci.yml : The CI file for our repository....
🌐
GitLab
gitlab.com › gitlab.org › repository
lib/gitlab/ci/templates/Docker.gitlab-ci.yml · master · GitLab.org / GitLab · GitLab
GitLab is the open-source DevSecOps platform that provides a complete software development lifecycle toolchain including source control, CI/CD, security scanning, and project management in a single application.
Find elsewhere
🌐
GitLab
docs.gitlab.com › gitlab docs › use gitlab › use ci/cd to build your application › jobs › docker › use docker to build docker images
Use Docker to build Docker images | GitLab Docs
In GitLab, add docker info to .gitlab-ci.yml to verify that Docker is working: default: before_script: - docker info build_image: script: - docker build -t my-docker-image . - docker run my-docker-image /script/to/run/tests · You can now use docker commands (and install Docker Compose if needed).
🌐
GitLab
forum.gitlab.com › gitlab ci/cd
Use your own image on GitlabCI - GitLab CI/CD - GitLab Forum
March 21, 2022 - Hello! This is my first post here, so apologies if I’m doing something wrong. I’m actually using Gitlab CI/CD with SaaS Runners. I am using public docker images, but I´m interested to use my own image, but I don’t want to upload to public registry. I have it uploaded on my own gitlab ...
🌐
Faun
faun.pub › building-a-docker-image-with-gitlab-ci-and-net-core-8f59681a86c4
Building a docker image with Gitlab CI and .NET Core | by Jelle Verheyen | FAUN.dev() 🐾
July 21, 2019 - Our pipeline will basically build the docker image through a Dockerfile and then push it to our Container Registry on Gitlab. We will make sure we steer clear of using any keys, credentials, tokens, etc. inside our pipeline to prevent them from being stolen. Let’s add a .gitlab-ci.yml file in ...
🌐
Docker Hub
hub.docker.com › r › gitlab › gitlab-ce
gitlab/gitlab-ce - Docker Image
The official GitLab Community Edition Docker image is available on Docker Hub⁠.
🌐
Medium
medium.com › @vergarawalterdomenico › gitlab-ci-cd-to-build-docker-images-for-different-environments-practical-example-with-angular-app-e8d2926264f7
GitLab CI/CD to build Docker images for different environments | Practical example with Angular app | by Walter Domenico Vergara | Medium
March 22, 2024 - Now it’s time to configure the CI/CD pipeline creating the .gitlab-ci.ymlin the root of your project like this: stages: - package services: - docker:dind # Build and package for DEV (development environment) package-dev: stage: package when: manual image: docker:latest script: - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - docker build -t $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME:$CI_COMMIT_TAG-dev --build-arg env=dev --no-cache .
🌐
Docker Hub
hub.docker.com › r › gitlab › gitlab-runner
gitlab/gitlab-runner - Docker Image
GitLab CI Multi Runner used to fetch and run pipeline jobs with GitLab CI · Image · 1.0K · 1B+ OverviewTags · We don't monitor the comments here, if you need help with running this GitLab Runner Docker image, please see https://about.gitlab.com/getting-help/⁠ ·
🌐
Lwolf
blog.lwolf.org › post › how-to-build-and-test-docker-images-in-gitlab-ci
How to build and test docker images in GitLab CI.
September 21, 2016 - So, I started with a simple .gitlab-ci.yml file, trying to build my python code: image: docker:latest services: - docker:dind stages: - build variables: CONTAINER_TEST_IMAGE: my-docker-hub/$CI_PROJECT_ID:$CI_BUILD_REF_NAME_test before_script: - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN ...
🌐
Stack Overflow
stackoverflow.com › questions › 74930125 › how-to-put-multiple-images-in-image-keyword-in-gitlab-ci
How to put multiple images in image keyword in gitlab-ci - Stack Overflow
Using the image and services keywords in your.gitlab-ci.yml file, you may define a GitLab CI/CD job that uses multiple Docker images.
Top answer
1 of 2
5

Since multi architecture/platform tags of a Docker image have different digests, You can pull a Docker image using its digest (instead of using tags) to pull the desired architecture/platform.

Here is an example of multi architecture/platform tag of a Docker image (Ubuntu) in Docker Hub: As you can see, 20.04 is a multi architecture tag and there are different digests for each of architectures in the tag.
If you run command docker pull ubuntu:20.04 it will pull all architectures.
But command
docker pull ubuntu@sha256:55e5613c8c7bcd8044aaf09d64d20518964a0d7a6e41af129f95b731301c2659 will pull just linux/arm/v7.

As I tried, it is possible to use digest in .gitlab-ci.yml:

job_1:
  image: ubuntu@sha256:55e5613c8c7bcd8044aaf09d64d20518964a0d7a6e41af129f95b731301c2659
  script:
    - ...

job_2:
  image: alpine@sha256:71465c7d45a086a2181ce33bb47f7eaef5c233eace65704da0c5e5454a79cee5
  script:
    - ...

2 of 2
0

Speaking of image digest, GitLab 13.5 (October 2020) proposes:

Create release with image digest on new tag

Docker supports immutable image identifiers and we have adopted this best practice to update our cloud-deploy images.

When a new image is tagged, we also programmatically retrieve the image digest upon its build, and create a release note to effectively communicate this digest to users.
This guarantees that every instance of the service runs exactly the same code.
You can roll back to an earlier version of the image, even if that version wasn’t tagged (or is no longer tagged). This can even prevent race conditions if a new image is pushed while a deploy is in progress.

See Documentation and Issue.

Top answer
1 of 4
21

The only thing needed to access docker images from another project on the same gitlab instance is that your project is allowed for Token Access on the project with the image.

No other configuration like docker login is needed. Just use image: $CI_REGISTRY/other/project:tag

job-in-project1:
  stage: test
  image: $CI_REGISTRY/group-b/otherproject:latest
  script:
    - command to run with docker image

Configuration:

  • Go to the project wich contains the image in its Container Registry. e.g. group-b/otherproject
  • Open Settings > CI/CD
  • Expand "Token Access"
  • in Allow CI job tokens from the following projects to access this project click "Add Project"

2 of 4
13

Right now it is possible to use images from your gitlab registry without any special steps. Just build and push an image to your gitlab project container registry

docker build -t registry.gitlab.com/gitlabProject/projectName:build .
docker push registry.gitlab.com/gitlabProject/projectName:build 

and then just specify this image in your pipeline settings:

image: registry.gitlab.com/gitlabProject/projectName:build

Gitlab is able to pull this image using it's credentials:

Preparing the "docker+machine" executor
00:46
 Using Docker executor with image registry.gitlab.com/gitlabProject/projectName:build ...
 Authenticating with credentials from job payload (GitLab Registry)
 Pulling docker image registry.gitlab.com/gitlabProject/projectName:build ...
 Using docker image sha256:e7e0f4f5fa8cff8a93b1f37ffd7dd0505946648246aa921dd457c06a1607304b for registry.gitlab.com/gitlabProject/projectName:build ...

More: https://docs.gitlab.com/runner/configuration/advanced-configuration.html#support-for-gitlab-integrated-registry

🌐
Spacelift
spacelift.io › blog › gitlab-ci-yml
Writing .gitlab-ci.yml File with Examples [Tutorial]
September 15, 2025 - The main keywords used to write .gitlab-ci.yml your pipelines include: ... The image keyword in .gitlab-ci.yml specifies the Docker image to use for the job. Your job will run within a container that’s started with this image.