0

This is a docker, docker-compose and django project.

Locally, it works when I run

docker-compose build
docker-compose run --rm app sh -c "python manage.py test"

However, it failed when I run

circleci local execute

The error I get is

docker-compose build

ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
Error:
Exited with code exit status 1

Here's the .circleci/config.yml.

version: 2
jobs:
  build:
    docker:
      - image: circleci/python:3.8.5
    working_directory: ~/app
    steps:
      - checkout
      - setup_remote_docker:
          docker_layer_caching: true
      - run:
          command: |
            docker-compose build
      - run:
          command: |
            docker-compose run --rm app sh -c "python manage.py test"

I was using travisci and it just works with the .travis.yml config file below:

language: python
python:
  - "3.8"

services:
  - docker

before_script: pip install docker-compose

script:
  - docker-compose run app sh -c "python manage.py test"

Would appreciate some pointers here. Thank you.

Mickey Cheong
  • 2,980
  • 6
  • 38
  • 50
  • Make sure docker daemon running in your local machine. `setup_remote_docker` uses your local docker daemon. – Subbu Aug 15 '20 at 02:56
  • if i run `docker-compose run app sh -c "python manage.py test"` on terminal, it works. but when i run `circleci local execute`, it failed. @Subbu any idea on verifying the docker daemon? I'm using Docker Desktop – Mickey Cheong Aug 15 '20 at 06:10
  • It looks like your docker-compose.yml file needs to mount volume `/var/run/docker.sock` – Alejandro Galera Aug 15 '20 at 09:44
  • @MickeyCheong You can check using `docker info` command. Or refer this -> https://stackoverflow.com/questions/43978837/how-to-check-if-docker-daemon-is-running – Subbu Aug 15 '20 at 14:45
  • @mulg0r do you have a link/reference on how to do that? i tried mounting the volume and it didn't work. – Mickey Cheong Aug 16 '20 at 02:16

0 Answers0