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 https://download.docker.com/linux/ubuntu/gpg | 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] https://download.docker.com/linux/ubuntu $(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 containerd.io docker-compose-plugin -y
CMD ["bash"]

Then inside my .gitlab-ci.yml:

image: 172.17.0.1:18073/docker-compose:latest
services:
  - docker:dind
build:
  stage: build
  script:
    - 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.