I have a Cookiecutter django project which uses Docker. I write my tests using
pytest and I run my tests using
docker-compose -f local.yml run django pytest. My
local.yml file is in my root dir (where manage.py is)
I want to run these tests automatically with Gitlab CI. For that I set up my own gitlab server, installed and configured the runners. As executor I am using docker.
Then I tried to configure my
gitlab-ci.yml file but I am not entirely sure how to do it correctly. This is what I have so far:
image: docker services: - docker:dind stages: - test tests-website: stage: test before_script: - apk update - apk upgrade - apk add python python-dev py-pip build-base libffi-dev openssl-dev libgcc - pip install docker-compose script: - docker-compose -f local.yml build - docker-compose -f local.yml run django pytest tags: - docker
My pipeline runs fine until
docker-compose -f local.yml build. Then I get
couldn't connect to Docker daemon at http://docker:2375 - is it running? If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
I assume that this is a misleading error since I am struggling a bit to understand how I can execute my local.yml file. Or how I can run my tests in the pipeline. Maybe there are also more configurations I have to do to get the tests running? Or maybe what I have so far is completely wrong? I am not sure...
Can someone help me out with this one? Help is very much appreciated! Thanks so much in advance!