<p>I image you have used the dockerExecutor in gitlab-runner. This means you try to use docker-in-docker.
<a href="https://docs.gitlab.com/ee/ci/docker/using_docker_build.html" rel="nofollow noreferrer">https://docs.gitlab.com/ee/ci/docker/using_docker_build.html</a></p>
<p>I suggest to configure the docker socket binding which might be less secure but very easy to handle.</p>
<p>To register a runner with docker-in-docker support mount the <code>/var/run/docker.sock:/var/run/docker.sock</code>
e.g.</p>
<pre><code>sudo gitlab-runner register -n \
  --url https://gitlab.com/ \
  --registration-token REGISTRATION_TOKEN \
  --executor docker \
  --description &quot;My Docker Runner&quot; \
  --docker-image &quot;docker:19.03.12&quot; \
  --docker-volumes /var/run/docker.sock:/var/run/docker.sock
</code></pre>

CC BY-SA 4.0
2020-08-18T21:41:10.630Z
2020-08-18T21:41:10.630Z
schmichri
<h2>Description:</h2>
<p>I have created a test project to serve a simple HTML page with <code>httpd:alpine</code> image. The following are the parts of the repository:</p>
<p><code>index.html</code>:</p>
<pre><code>&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
    &lt;meta charset=&quot;UTF-8&quot;&gt;
    &lt;title&gt;Rostami test page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;h1&gt;Hey guys!&lt;/h1&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
<p><code>Dockerfile</code>:</p>
<pre><code>FROM httpd:alpine

COPY ./ /usr/local/apache2/htdocs/
</code></pre>
<p><code>docker-compose.yml</code>:</p>
<pre><code>version '2.2'

services:
  myhtml:
  image: html_mrt:latest
  ports:
  - &quot;9999:80&quot;
  restart: on-failure
  container_name: HTML_Rostami
</code></pre>
<p><code>.gitlab-ci.yml</code>:</p>
<pre><code>stages:
  - build
  - deploy

build:
  stage: build
  script:
  - docker build -t html_mrt .
  tags:
  - docker

deploy:
  stage: deploy
  script:
  - docker-compose up -d
  - docker rmi $(docker image -q filter &quot;dangling=true&quot;)
  tags:
    - docker
</code></pre>
<hr />
<h2>Issue:</h2>
<p>In addition, when I execute <code>gitlab-runner status</code> on the GitLab-Runner container, it says:</p>
<pre><code>Runtime platform                                    arch=amd64 os=linux pid=79 revision=a998cacd version=13.2.2
gitlab-runner: Service is not running.
</code></pre>
<p>I've tried to start the service by <code>gitlab-runner start</code> but nothing has affected.</p>
<hr />
<h2>Problem:</h2>
<p>It's the log of the build stage:</p>
<pre><code>Running with gitlab-runner 13.2.2 (a998cacd)
  on Test K-1ZsHyF
Preparing the &quot;docker&quot; executor
00:11

Using Docker executor with image docker ...
Pulling docker image docker ...
Using docker image sha256:81f5749c9058a7284e6acd8e126f2b882765a17b9ead14422b51cde1a110b85c for docker ...
Preparing environment
00:02

Running on runner-k-1zshyf-project-1-concurrent-0 via 806fd175c866...
Getting source from Git repository
00:03

Fetching changes with git depth set to 50...
Reinitialized existing Git repository in /builds/m.rostami/test/.git/
Checking out 82d339a9 as master...
Skipping Git submodules setup
Executing &quot;step_script&quot; stage of the job script
00:04

$ docker build -t html_mrt .
time=&quot;2020-08-18T06:36:52Z&quot; level=error msg=&quot;Can't add file /builds/m.rostami/test/docker-compose.yml to tar: io: read/write on closed pipe&quot;
time=&quot;2020-08-18T06:36:52Z&quot; level=error msg=&quot;Can't close tar writer: io: read/write on closed pipe&quot;
error during connect: Post http://docker:2375/v1.40/build?buildargs=%7B%7D&amp;cachefrom=%5B%5D&amp;cgroupparent=&amp;cpuperiod=0&amp;cpuquota=0&amp;cpusetcpus=&amp;cpusetmems=&amp;cpushares=0&amp;dockerfile=Dockerfile&amp;labels=%7B%7D&amp;memory=0&amp;memswap=0&amp;networkmode=default&amp;rm=1&amp;session=8jgar93piqxu2s7y5yp9w2wtg&amp;shmsize=0&amp;t=html_mrt&amp;target=&amp;ulimits=null&amp;version=1: dial tcp: lookup docker on 192.168.1.1:53: no such host
ERROR: Job failed: exit code 1
</code></pre>
<p><code>192.168.1.1</code> is the default gateway and nameserver of the host that the Docker daemon is running.</p>
<p>How to fix the problem?</p>
<p>Thanks in advance.</p>

<gitlab><gitlab-ci-runner><apache-httpd>
GitLab pipeline stop at the stage of pulling an image from Docker hub
Mohi Rostami
# GitLab pipeline stop at the stage of pulling an image from Docker hub

(Asked by: username_0 on 2020-08-18)

Description:
I have created a test project to serve a simple HTML page with httpd:alpine image. The following are the parts of the repository:
index.html:


    
    Rostami test page


    Hey guys!



Dockerfile:
FROM httpd:alpine

COPY ./ /usr/local/apache2/htdocs/

docker-compose.yml:
version '2.2'

services:
  myhtml:
  image: html_mrt:latest
  ports:
  - "9999:80"
  restart: on-failure
  container_name: HTML_Rostami

.gitlab-ci.yml:
stages:
  - build
  - deploy

build:
  stage: build
  script:
  - docker build -t html_mrt .
  tags:
  - docker

deploy:
  stage: deploy
  script:
  - docker-compose up -d
  - docker rmi $(docker image -q filter "dangling=true")
  tags:
    - docker


Issue:
In addition, when I execute gitlab-runner status on the GitLab-Runner container, it says:
Runtime platform                                    arch=amd64 os=linux pid=79 revision=a998cacd version=13.2.2
gitlab-runner: Service is not running.

I've tried to start the service by gitlab-runner start but nothing has affected.

Problem:
It's the log of the build stage:
Running with gitlab-runner 13.2.2 (a998cacd)
  on Test K-1ZsHyF
Preparing the "docker" executor
00:11

Using Docker executor with image docker ...
Pulling docker image docker ...
Using docker image sha256:81f5749c9058a7284e6acd8e126f2b882765a17b9ead14422b51cde1a110b85c for docker ...
Preparing environment
00:02

Running on runner-k-1zshyf-project-1-concurrent-0 via 806fd175c866...
Getting source from Git repository
00:03

Fetching changes with git depth set to 50...
Reinitialized existing Git repository in /builds/m.rostami/test/.git/
Checking out 82d339a9 as master...
Skipping Git submodules setup
Executing "step_script" stage of the job script
00:04

$ docker build -t html_mrt .
time="2020-08-18T06:36:52Z" level=error msg="Can't add file /builds/m.rostami/test/docker-compose.yml to tar: io: read/write on closed pipe"
time="2020-08-18T06:36:52Z" level=error msg="Can't close tar writer: io: read/write on closed pipe"
error during connect: Post http://docker:2375/v1.40/build?buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&labels=%7B%7D&memory=0&memswap=0&networkmode=default&rm=1&session=8jgar93piqxu2s7y5yp9w2wtg&shmsize=0&t=html_mrt⌖=&ulimits=null&version=1: dial tcp: lookup docker on 192.168.1.1:53: no such host
ERROR: Job failed: exit code 1

192.168.1.1 is the default gateway and nameserver of the host that the Docker daemon is running.
How to fix the problem?
Thanks in advance.

**Tags:** gitlab, gitlab-ci-runner, apache-httpd


---

## 1 answers

### Answer by username_1 on 2020-08-18. Score: 2

I image you have used the dockerExecutor in gitlab-runner. This means you try to use docker-in-docker.
https://docs.gitlab.com/ee/ci/docker/using_docker_build.html
I suggest to configure the docker socket binding which might be less secure but very easy to handle.
To register a runner with docker-in-docker support mount the /var/run/docker.sock:/var/run/docker.sock
e.g.
sudo gitlab-runner register -n \
  --url https://gitlab.com/ \
  --registration-token REGISTRATION_TOKEN \
  --executor docker \
  --description "My Docker Runner" \
  --docker-image "docker:19.03.12" \
  --docker-volumes /var/run/docker.sock:/var/run/docker.sock


---

