🌐
Spacelift
spacelift.io › blog › gitlab-ci-yml
Writing .gitlab-ci.yml File with Examples [Tutorial]
September 15, 2025 - image: ubuntu:latest job1: script: - echo "Uses the ubuntu:latest image" job2: image: busybox:latest script: - echo "Uses the busybox:latest image" In .gitlab-ci.yml, stages keyword can only be used at the top level. It defines the stages to include in your pipeline, with their execution order. Stages are run in the order that they’re written: stages: - test - build test_job1: stage: test # ... test_job2: stage: test # ... build_job: stage: build # ... In the example above, the pipeline will begin with the test_job1 and test_job2 jobs executing in parallel within the test stage.
🌐
GitLab
docs.gitlab.com › gitlab docs › use gitlab › use ci/cd to build your application › jobs › docker › run ci/cd jobs in docker containers
Run your CI/CD jobs in Docker containers | GitLab Docs
Use the image checksum in your job definition in your .gitlab-ci.yml file to verify the integrity of the image. A failed image integrity verification prevents you from using a modified container. To use the image checksum you have to append the checksum at the end: image: ruby:2.6.8@sha256:d1dbaf9665fe8b2175198e49438092fdbcf4d8934200942b94425301b17853c7 · To get the image checksum, on the image TAG tab, view the DIGEST column. For example, view the Ruby image.
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
docker - gitlab ci yml image and services mechanism? - Stack Overflow
I don't understand the mechanism ... file.gitlab-ci.yml. when do we know on which image the commands of the keyword script are executed ? When i read the gitlabci documentation i understand the theory of the keywords "image" and "services" well, so i have already done tests and managed to interact with a httpd service by a wget for example, however, ... More on stackoverflow.com
🌐 stackoverflow.com
What is the difference between default:image and image?
The example uses the image keyword at the top level to set the default image. image: alpine However, in the .gitlab-ci.yml keyword reference, the following is used to set the default image. default: image: ruby:3.0 Are these two ways to specify the default image equivalent? More on forum.gitlab.com
🌐 forum.gitlab.com
3
0
May 3, 2023
GitLab pipeline and building docker images
For GitLab.com shared runners -- this would be a minimal CI file, assuming you have a Dockerfile in the root of your repository: build: image: docker services: docker:dind script: - docker build -t test . More on reddit.com
🌐 r/gitlab
7
2
November 3, 2023
People also ask

Where should the .gitlab-ci.yml file be placed?
The .gitlab-ci.yml file must be placed in the root directory of your GitLab repository. This is the default and only supported location GitLab CI/CD looks for when triggering pipelines. For larger setups, you can split pipeline logic into multiple files and include them, but the main .gitlab-ci.yml at the root is always required to act as the entry point.
🌐
spacelift.io
spacelift.io › blog › gitlab-ci-yml
Writing .gitlab-ci.yml File with Examples [Tutorial]
Does GitLab have CI/CD pipelines?
Yes, GitLab has built-in CI/CD pipelines as a core feature of its platform. GitLab CI/CD enables automated testing, building, and deployment through .gitlab-ci.yml, a configuration file stored in the repository.
🌐
spacelift.io
spacelift.io › blog › gitlab-ci-yml
Writing .gitlab-ci.yml File with Examples [Tutorial]
🌐
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 ... 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 ...
🌐
DEV Community
dev.to › spacelift › writing-gitlab-ciyml-file-with-examples-5dkm
Writing .gitlab-ci.yml File with Examples - DEV Community
April 28, 2025 - image: ubuntu:latest job1: script: - echo "Uses the ubuntu:latest image" job2: image: busybox:latest script: - echo "Uses the busybox:latest image" In .gitlab-ci.yml, stages keyword can only be used at the top level. It defines the stages to include in your pipeline, with their execution order. Stages are run in the order that they're written: stages: - test - build test_job1: stage: test # ... test_job2: stage: test # ... build_job: stage: build # ... In the example above, the pipeline will begin with the test_job1 and test_job2 jobs executing in parallel within the test stage.
🌐
GitHub
gist.github.com › florentchauveau › 2dc4da0299d42258606fc3b0e148fc07
GitLab CI yaml file for building docker images · GitHub
GitLab CI yaml file for building docker images · Raw · .gitlab-ci.yml · This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
🌐
DevOpsSchool.com
devopsschool.com › blog › gitlab-tutorials-example-of-gitlab-ci-yml
GitLab Tutorials: Example of .gitlab-ci.yml
September 7, 2022 - # # To contribute improvements to CI/CD templates, please follow the Development guide at: # https://docs.gitlab.com/ee/development/cicd/templates.html # This specific template is located at: # https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.ymlCode language: PHP (php) image: busybox:latest before_script: - echo "Before script section" - echo "For example you might run an update here or install a build dependency" - echo "Or perhaps you might print out some debugging details" after_script: - echo "After script section" - echo "For example yo
🌐
Bitslovers
bitslovers.com › gitlab-ci-yml-examples
Practical Examples of GitLab CI YML | Bits Lovers' - Cloud Computing and DevOps
May 19, 2023 - stages: - validate_cf_template - deploy_cf_stack validate_cf_template: stage: validate_cf_template image: amazon/aws-cli:$AWS_CLI_VERSION script: - aws cloudformation validate-template --template-body file://$CI_PROJECT_DIR/cf-stack.yaml deploy_cf_stack: stage: deploy_cf_stack image: amazon/aws-cli:$AWS_CLI_VERSION script: - aws cloudformation deploy --template-file $CI_PROJECT_DIR/cf-stack.yaml --stack-name GitLab-CI-Stack · stages: - lint_ansible_playbook - execute_ansible_playbook lint_ansible_playbook: stage: lint_ansible_playbook image: ansible/ansible-lint:devel script: - ansible-lint playbook.yml execute_ansible_playbook: stage: execute_ansible_playbook image: williamyeh/ansible:ubuntu2204 script: - ansible-playbook -i inventory.ini playbook.yml
Find elsewhere
🌐
Callr
blog.callr.tech › building-docker-images-with-gitlab-ci-best-practices
Best practices for building docker images with GitLab CI · Callr Tech Blog
August 27, 2021 - Here is a .gitlab-ci.yml file that you can drop in directly without any modification in a project with a working Dockerfile. ... All docker images will be pushed to the GitLab Container Registry.
🌐
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…
🌐
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
May 8, 2023 - You can avoid this disk-intensive ... for example overlay2. Ensure a recent kernel is used, preferably >= 4.2. ... If you see no result, then the module is not loaded. To load the module, use: ... If the module loaded, you must make sure the module loads on reboot. On Ubuntu systems, do this by adding the following line to /etc/modules: ... You can enable the driver for each project individually by using the DOCKER_DRIVER CI/CD variable in .gitlab-ci.yml...
🌐
C# Corner
c-sharpcorner.com › home › technologies › devops › creating image using yml file in gitlab
Creating Image Using YML File in GITLAB
Check the pipeline CI/CD pipeline, it will automatically execute and create an image at the GIT Registry. ... Create an Account in DockerHub. Docker file part is already done in the above steps. Update the YML file to create an Image with these lines. Push/Commit/Check-in Everything(Dockerfile + .gitlab-ci.yml)
🌐
GitLab
docs.gitlab.com › gitlab docs › use gitlab › deploy and release your application › packages & registries › container registry › build and push images
Build and push container images to the container registry | GitLab Docs
build: image: docker:24.0.5-cli stage: build services: - docker:24.0.5-dind script: - echo "$CI_REGISTRY_PASSWORD" | docker login $CI_REGISTRY -u $CI_REGISTRY_USER --password-stdin - docker build -t $CI_REGISTRY/group/project/image:latest . - docker push $CI_REGISTRY/group/project/image:latest · You can use CI/CD variables in your .gitlab-ci.yml file. For example:
🌐
GitHub
gist.github.com › RyanHarijanto › 217d62534260fd2ee63278b3c293cd10
.gitlab-ci.yml example: multiple Docker images · GitHub
.gitlab-ci.yml example: multiple Docker images. GitHub Gist: instantly share code, notes, and snippets.
🌐
University of Toronto
microfluidics.utoronto.ca › help › help
Using docker images · Docker · Ci · Help · GitLab
Use the image checksum in your job definition in your .gitlab-ci.yml file to verify the integrity of the image. A failed image integrity verification prevents you from using a modified container. To use the image checksum you have to append the checksum at the end: image: ruby:2.6.8@sha256:d1dbaf9665fe8b2175198e49438092fdbcf4d8934200942b94425301b17853c7 · To get the image checksum, on the image TAG tab, view the DIGEST column. For example, view the Ruby image.
🌐
GitLab
docs.gitlab.com › ee › ci › yaml › gitlab_ci_yaml.html
The `.gitlab-ci.yml` file
June 6, 2023 - When you visit any website, it may store or retrieve information on your browser, mostly in the form of cookies. This information might be about you, your preferences, or your device, and is mostly used to make the site work as you expect. The information does not usually identify you directly, ...
🌐
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 .
🌐
GitLab
forum.gitlab.com › gitlab ci/cd
What is the difference between default:image and image? - GitLab CI/CD - GitLab Forum
May 3, 2023 - The example uses the image keyword at the top level to set the default image. image: alpine However, in the .gitlab-ci.yml keyword reference, the following is used to set the default image. default: image: ruby:3.0 Are these two ways to specify the default image equivalent?
🌐
Hifis
hifis.net › workshop-materials › gitlab-ci › episodes › 08-using-includes
Using Includes - Continuous Integration in GitLab - HIFIS
File .gitlab/ci/lint.gitlab-ci.yml defines all CI jobs in stage lint: license-compliance: stage: lint extends: - .base_image - .dependencies script: - uv run reuse lint needs: [] codestyle: stage: lint extends: - .base_image - .dependencies script: - uv run black --check --diff --fast .
🌐
Codefresh
codefresh.io › home › devops › gitlab ci/cd › gitlab yaml
What Is The .gitlab-ci.yml File And How To Work With It | Octopus Deploy
GitLab is an open source code repository and Continuous Integration / Continuous Delivery (CI/CD) platform. There are two basic requirements to use GitLab CI/CD: application code hosted in a Git repository, and a file called .gitlab-ci.yml in the root of the repository, which specifies the GitLab configuration.