This is my .gitlab-ci.yml file in my repo:
image: docker
#services:
# - docker:dind
stages:
- build
- deploy
build-prod:
stage: build
only:
- master
tags:
- docker
script:
- docker network create -d overlay reprox
environment: master
deploy-prod:
stage: deploy
only:
- master
tags:
- docker
script:
- docker stack deploy -c ./site1/docker-compose.yml site1
- docker stack deploy -c ./site2/docker-compose.yml site2
- docker stack deploy -c ./site3/docker-compose.yml site3
- docker stack deploy -c ./reverse-proxy/docker-compose.yml proxy
environment: master
So my setup is 1 manager and 2 worker nodes and I only need to run build and deploy jobs on manager node, other nodes just need to have the repo, no need for running the bash commands on worker nodes.
I added a manager runner with "docker" tag and worker nodes with "runner" tag.
Remove your docker
tag. You can configure your workers to work only on specific tags
job1:
tags:
- dockernode_1
job2:
tags:
- dockernode_2
Your previously used docker
tag was probably just a workaround (or from a tutorial) to make the runners work on all jobs. If you don't want a runner to care about tagging, you can make him pick up all available jobs.