vbrin27
vbrin27

Reputation: 991

GitLab Runner - Docker Image

I started to work with GitLab CI/CD. I have setup my own GitLab-runner with docker executor. It is working fine. When I read about docker, I came to know that it creates a separate space for each run so that we could even access it and use it. I would like to know the path in which the docker images are created.

This is my config.toml

concurrent = 1
check_interval = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "Linux-Docker1"
  url = "https://gitlab.com/"
  token = "4-UWY1A_J2rS7r32wxJi"
  executor = "docker"
  builds_dir = "/var/working/gitlab-runner-docker"
  [runners.custom_build_dir]
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]
  [runners.docker]
    tls_verify = false
    image = "ruby:2.6"
    privileged = false
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/cache"]
    shm_size = 0

[[runners]]
  name = "Linux-Shell1"
  url = "https://gitlab.com/"
  token = "LzdxrS1zA58rXihSQWCn"
  executor = "shell"
  builds_dir = "/var/working/gitlab-runner"
  [runners.custom_build_dir]
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]

This is my .gitlab-ci.yml file

stages:
  - build
  - test

build:
  stage: build
  script:
    - whoami
    - mkdir test-build
    - touch test-build/info.txt
    - ls
    - pwd
    - cd ..
    - pwd
    - ls
  artifacts:
    paths:
      - test-build/

test:
  stage: test
  script:
    - echo "Test Script"
    - ls
    - test -f "test-build/info.txt"

Upvotes: 1

Views: 973

Answers (1)

Sergio Tanaka
Sergio Tanaka

Reputation: 1435

In your case you didn't create a docker image, because in your build step you do not run docker build command

about the path, if you build a docker image, you need to push it to a container registry (docker hub or a private one)

look at this doc to know how to do it

https://docs.gitlab.com/ee/ci/docker/using_docker_build.html

Upvotes: 1

Related Questions