Docker login error: "Cannot connect to the Docker daemon"

I’m building a docker image with circleci and i receiving this error:

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

My build config;

  deploy_sambaplay-viewer:
    docker:
      - image: circleci/node:9.9.0-stretch-browsers
    working_directory: ~/sambaplay-viewer
    steps:
      - attach_workspace:
          at: ~/sambaplay-viewer
      - setup_remote_docker:
          docker_layer_caching: true
      - run:
          name: Deploy on AWS ElasticBeanstalk Docker
          command: |
              npm run login:docker

I guess the error comes from the login:docker. I’ve not seen it run via NPM before, but essentially this would be the same as a docker login <args> command.

I would imagine that you don’t have Docker installed in this container, nor a Docker daemon running; I think the setup_remote_docker command just contacts the Docker running in the host. You’re running stuff in the guest, so you don’t have anything to contact. However, Docker-in-Docker configurations do work - just install it first.

You can either install it using apt or apk (depending on the parent distro) or, if you don’t actually need Node and the pre-installed browsers, you can just switch to docker:17.05.0-ce-git (that’s the version I use, there’s probably something more recent).

ok, edited.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.