Unable to use Docker with circleci/node image


I am using CircleCI 2.0 and I am planning to use specific version of Node.js on my CircleCI.

Here is what I wrote on my config.yml to use default CircleCI machine with old version of Node.js 6.1.

version: 2
        machine: true

In order to use Node v8, I adopted docker in place of machine:

version: 2
            - image: circleci/node:8.9.3-browsers

However, this specific docker image from CircleCI doesn’t work properly. According to the description from circleci/node, the image should contain docker installation and I think docker commands should also work fine. BUT inside circle,

$ docker --version
   Docker version 17.12.0-ce, build c97c6d6
$ docker run hello-world
   Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
$ sudo service docker status
   docker: unrecognized service

What am I wrong?
Hope to get some help to resolve this issue!

1 Like

I would also be interested in this question!

You’ll need to include the setup_remote_docker step before using the docker daemon thread.

Here’s some documentation if you need more information: https://circleci.com/docs/2.0/building-docker-images/

1 Like

Thank you @brandonschabell. setup_remote_docker works for me.

By the way, I have a different question.
I have to use docker-compose to work with multiple docker containers, but according to these two CircleCI guides Running Docker Commands and Installing and Using docker-compose, I wonder if my docker containers can communicate/interact with each other as they did before with machine mode.

So I want to get either the way to allow containers to communicate with each other without problem with docker mode or the way to upgrade Node.js with machine mode.

Thank you in advance.

  • PS: Running Docker Commands
    The job and remote docker run in separate environments. Therefore, Docker containers cannot directly communicate with the containers running in remote docker.

  • PS: Installing and Using docker-compose
    If you want to use docker compose to manage a multi-container setup, use the machine key in your config.yml file and use docker-compose as you would normally.

In general, that is a good reason to post in a new thread. I’m just another contributor, but mostly readers of this kind of forum like to see one topic per post. Note DC-in-Docker has been covered a few times on this forum, so it would be worth doing a search first.

I might be able to help you on that, so ping me on a new thread if you create it :smiley_cat:

Moved to new thread: Best Practice to Use Multiple Containers with docker-compose