WARNING! Using --password via the CLI is insecure. Use --password-stdin

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

Have you solved this issue? Cause am facing it now!

Hey there,

This looks to me like a DNS issue (port 53 is normally dns service)… Which is maybe happening because those variables are incorrectly used. I think you can use those variables simply as $CI_REGISTRY (instead of ${CI_REGISTRY}). Also, there are other useful variables like $CI_REGISTRY_IMAGE to simplify your script. E.g.:

script:
  - echo -n $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY
  - docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG .
  - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG  # no need for "." at the end!

Similar goes for the release job…