Gitlab CE online docker CI

I’m using the public gitlab ci runners for ci / cd.
I want to build a docker image in one of my stages, but I get the error:

$ docker build -t $APP_IMAGE .
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
ERROR: Job failed: exit code 1

This is the job:

build:
  image: docker
  stage: build
  script:
    - docker build -t $APP_IMAGE .
    - docker tag $APP_IMAGE $HEROKU_IMAGE
  tags:
    - docker
  only:
    - master

How can I connect the docker client to the docker engine?