Gitlab runner- docker: command not found

I install gitlab-runner on ubuntu 18.04 and add to section


  • “dotnet restore”
  • docker info

But I have an error on pipeline

/bin/bash: line 82: docker: command not found

Why runner can we not use docker?

op@vm2:~$ docker -v
Docker version 19.03.3, build a872fc2f86

op@vm2:~$ sudo -u gitlab-runner -H docker info
Debug Mode: false

Containers: 2
Running: 0
Paused: 0
Stopped: 2
Images: 2
Server Version: 19.03.3
Storage Driver: overlay2

Hi @nipua and welcome to the GitLab Community Forum!

Great question.

This error /bin/bash: line 82: docker: command not found would indicate that either:

  1. docker was not found in the docker image required in your pipeline
  2. gitlab-runner is registered to use docker executor or docker-in-docker

What executor was set when registering the GitLab runner on your GitLab instance?

If you’re using the docker executor or docker in docker, which image keyword are you using? Would it be feasible to use an image with docker already installed, or install docker inside the image used?

If you have any questions, please don’t hesitate to ask!

Hello @gitlab-greg thanks for great answer! The problem was that I don’t added docker image in deploy section. But now I have a new problem when I do manually git clone and run docker build . -all right. And when gitlab-runner launches stage with deployment section

- docker build -t $image_tag .

I have a new error

$ dotnet restore
/bin/sh: eval: line 76: dotnet: not found

though first line in .Dockerfile

FROM microsoft/dotnet:2.2-sdk AS build