Using docker compose inside CI

I’m trying to run docker compose inside of a runner but keep getting the error:

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

I’ve setup a container that has docker and compose installed like so:

FROM ubuntu:20.04
RUN apt-get update && apt-get install ca-certificates curl gnupg lsb-release default-jdk -y
RUN curl -fsSL | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
RUN apt-get update && apt-get install docker-ce docker-ce-cli docker-compose-plugin -y
CMD ["bash"]

Then inside my .gitlab-ci.yml:

  - docker:dind
  stage: build
    - docker compose up

But so far I have been unsuccessful in getting this to work, it appears that docker commands do work but compose does not.