1
resposta

Erro no build

Tive erro ao commitar e dar push no meu projeto...segue o arquivo e o erro.

image: docker:stable

stages:

  • pre-build
  • build
  • test
  • deploy

services:

  • docker:dind

before_script:

  • docker info
  • docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD

build-docker: stage: pre-build script:

  • docker build -t devops .
  • docker tag devops wqueiroz28dev/devops:latest
  • docker push wqueiroz28dev/devops:latest

build-project: stage: build tags:

  • executor-tarefas dependencies:
  • build-dockerscript:
  • echo "runner"

////////////////////////////////ERROR: error during connect: Get http://docker:2375/v1.40/info: dial tcp: lookup docker on 192.168.16.1:53: no such host errors pretty printing info///////////////////////////////////////////////////////////////////////// ERRO

1 resposta

Esse é um problema conhecido, basta adicionar as variables que fazem a configuração do docker e tudo funcionará.

Toque o inicio do seu código pelo abaixo:

stages:
   - pre-build
   - build
   - test
   - deploy

variables:
  DOCKER_HOST: tcp://docker:2375/
  DOCKER_DRIVER: overlay2

services:
  - docker:dind

Segue exemplo pessoal funcionando:

image: docker:dind
services:
  - docker:dind

stages:
  - Unit Test
  - Build Web

variables:
  DOCKER_HOST: tcp://docker:2375/
  DOCKER_DRIVER: overlay2


Unit Test:
  stage: Unit Test
  script:   
    - ls

Build Web:
  stage: Build Web
  image: node
  script:   
    - npm i
    - npm run build
  artifacts:
    paths:
      - build/