I setup a GitLab runner on EC2 which triggers jobs on a Fargate ECS cluster. I followed this tutorial step by step: https://docs.gitlab.com/runner/configuration/runner_autoscale_aws_fargate
During my CI/CD I build docker image then I want to reuse them during other stages of my CI/CD. So when I used shared runner I used docker dind:
image: docker:stable
services:
- docker:dind
My config.toml
looks like this:
concurrent = 1
check_interval = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "fargate-runner"
url = "https://gitlab.com/"
token = "KRGVsYCF-V-D1u7UvCjq"
executor = "custom"
builds_dir = "/opt/gitlab-runner/builds"
cache_dir = "/opt/gitlab-runner/cache"
[runners.custom]
config_exec = "/opt/gitlab-runner/fargate"
config_args = ["--config", "/etc/gitlab-runner/fargate.toml", "custom", "config"]
prepare_exec = "/opt/gitlab-runner/fargate"
prepare_args = ["--config", "/etc/gitlab-runner/fargate.toml", "custom", "prepare"]
run_exec = "/opt/gitlab-runner/fargate"
run_args = ["--config", "/etc/gitlab-runner/fargate.toml", "custom", "run"]
cleanup_exec = "/opt/gitlab-runner/fargate"
cleanup_args = ["--config", "/etc/gitlab-runner/fargate.toml", "custom", "cleanup"]
What should I do to use docker command during my CI/CD and to keep docker image of each build between all stages?