Docker dind : Cannot connect to the Docker daemon

10,344

just add --privileged to command.

docker run --rm -it --privileged docker:stable-dind docker login -u user -p password https://registry.mine.io

Share:
10,344
ricko zoe
Author by

ricko zoe

Updated on June 04, 2022

Comments

  • ricko zoe
    ricko zoe almost 2 years

    While running docker:dind I can't use docker login command and any other docker command.

    My use case is that I got a Nexus Docker Registry and I'm trying to connect to this registry through GitLab CI.

    docker run --rm -it docker:stable-dind docker login -u user -p password https://registry.mine.io
    

    Give:

    Warning: failed to get default registry endpoint from daemon (Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?). Using system default: https://index.docker.io/v1/
    Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
    
  • ricko zoe
    ricko zoe about 6 years
    Thanks. After I also find out more information about '--privileged' with gitlab-ci. I have to set privileged to true in the configuration file of my runner ~/.gitlab-runner/config.toml docs.gitlab.com/ce/ci/docker/using_docker_build.html
  • Bizmate
    Bizmate almost 2 years
    Not sure how this answer is marked as correct. Still getting an error with this $ docker run -it --rm --privileged --user dockremap docker:stable-dind docker ps error during connect: Get http://docker:2375/v1.40/containers/json: dial tcp: lookup docker on 194.168.4.100:53: no such host