Skip to main content
added 299 characters in body
Source Link

.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

.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
Source Link

GitLab pipeline stop at the stage of pulling an image from Docker hub

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:

<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Rostami test page</title>
</head>
<body>
    <h1>Hey guys!</h1>
</body>
</html>

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

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&target=&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.