Hi everyone! the essence is this : I started the build of the docker image in the ci cd pipeline and at the “build” step does not pass authorization for a reason unknown to me, gives an error:
$ docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY}
WARNING! Using --password via the CLI is insecure. User --password-stdin.
error during connect: Post http://docker:2375/v1.40/auth: dialtcp: lookup docker on 192.168.0.1:53: no such host
Cleaning up project directory and file based variables
00:00
ERROR: Job failed: exit code 1
has anyone encountered this and can help? since I 'm still just learning CI СD . perhaps even a stupid mistake due to my lack of knowledge and competence in this area.
my ci-cd.yml file :
stages: # List of stages for jobs, and their order of execution
- test
- build
- release
Django Tests:
stage: test
image: python:latest
script:
- pip install -r requirements.txt
- python manage.py test --noinput
tags:
- docker
Docker Build:
stage: build
image: docker:stable
services:
- docker:dind
script:
- docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY}
- docker build -t ${CI_REGISTRY}/${CI_PROJECT_PATH}/{CI_PROJECT_NAME}:${CI_COMMIT_REF_SLUG} .
- docker push ${CI_REGISTRY}/${CI_PROJECT_PATH}/${CI_PROJECT_NAME}:${CI_COMMIT_REF_SLUG} .
tags:
- docker
Release:
stage: release
image: docker:stable
services:
- docker:dind
script:
- docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY}
- docker pull ${CI_REGISTRY}/${CI_PROJECT_PATH}/${CI_PROJECT_NAME}:${CI_COMMIT_REF_SLUG}
- DOCKER tag ${CI_REGISTRY}/${CI_PROJECT_PATH}/${CI_PROJECT_NAME}:${CI_COMMIT_REF_SLUG} ${CI_REGISTRY}/${CI_PROJECT_PATH}/${CI_PROJECT_NAME}:latest
- docker push ${CI_REGISTRY}/${CI_PROJECT_PATH}/${CI_PROJECT_NAME}:latest
when: manual
tags:
- docker