I'm trying to implement CD for my dockerized Django app using Gitlab with a specific runner at a DigitalOcean droplet.
Here's my .gitlab-ci.yml
image:
name: docker/compose:1.29.2
entrypoint: [""]
services:
- docker:dind
# - docker:18-dind
stages:
- build
- deploy
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
before_script:
- export IMAGE=$CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME
- export WEB_IMAGE=$IMAGE/web:web
- export NGINX_IMAGE=$IMAGE/nginx:nginx
- apk add --no-cache openssh-client bash
- chmod +x ./setup_env.sh
- bash ./setup_env.sh
- docker login -u $CI_REGISTRY_USER -p $CI_JOB_TOKEN $CI_REGISTRY
- mkdir -p ~/.ssh
- echo "${SSH_PRIVATE_KEY}" | tr -d '\r' > ~/.ssh/py_key
- cat ~/.ssh/py_key
- chmod 700 ~/.ssh
- chmod 600 ~/.ssh/py_key
- eval "$(ssh-agent -s)"
- ssh-add ~/.ssh/py_key
- ssh-keyscan -H 'gitlab.com' >> ~/.ssh/known_hosts
build:
stage: build
tags:
- pythonist
script:
- docker pull $IMAGE/web:web || true
- docker pull $IMAGE/nginx:nginx || true
- docker-compose -f docker-compose.ci.yml build
- docker push $IMAGE/web:web
- docker push $IMAGE/nginx:nginx
deploy:
stage: deploy
script:
- chmod +x ./deploy.sh
- scp -o StrictHostKeyChecking=no -r ./.env ./docker-compose.prod.yml root@$DO_PUBLIC_IP_ADDRESS:/root/Pythonist.org/
- bash ./deploy.sh
only:
- master
And here's the gitlab-runner/config.toml:
[[runners]]
name = "pythonist-on-gitlab"
url = "https://gitlab.com/ci"
token = "token"
executor = "docker"
[runners.custom_build_dir]
[runners.cache]
[runners.cache.s3]
[runners.cache.gcs]
[runners.cache.azure]
[runners.docker]
tls_verify = false
image = "docker/compose:1.29.2"
privileged = flase
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
# volumes = ["/cache"]
shm_size = 0
#privileged = true
volumes = ["/cache","/var/run/docker.sock:/var/run/docker.sock"]
When I push to the repository to trigger a build, here's the error I get:
$ docker login -u $CI_REGISTRY_USER -p $CI_JOB_TOKEN $CI_REGISTRY
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
error during connect: Post http://docker:2375/v1.40/auth: dial tcp: lookup docker on 67.207.67.3:53: no such host
What might be wrong here?