Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error response from daemon:request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

IM trying to deploy on prod. But was gotting this error

Error response from daemon: Get https://registry.gitlab.com/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

gitlab-ci:

docker_push:
 stage: docker
 services:
- docker:dind
 script:
 - apk add --no-cache docker  
 - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com
 - mvn -B package -Dmaven.test.skip=true docker:build -DpushImage

job_deploy_prod:
stage: deploy
only:
 - master
 - tags
when: manual
environment:
name: prod
variables:
SERVER: serverBNP-prod1
SSH_OPTS: -p 22 -l udoc -o BatchMode=true -o StrictHostKeyChecking=no
script:
- export VERSION=$(fgrep -m 1 -w version pom.xml | sed -re 's/^.*>(.*)<.*$/\1/')
- ssh $SSH_OPTS -i $HOME/.ssh/id_rsa $SERVER "docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com" 
- ssh $SSH_OPTS -i $HOME/.ssh/id_rsa $SERVER "docker rm -f proj"
- ssh $SSH_OPTS -i $HOME/.ssh/id_rsa $SERVER "docker pull registry.gitlab.com/bnp/proj:$VERSION"
- ssh $SSH_OPTS -i $HOME/.ssh/id_rsa $SERVER "docker run -d -p 8080:8080 -e 'SPRING_PROFILES_ACTIVE=prod' -v /etc/localtime:/etc/localtime -v /etc/timezone:/etc/timezone --name proj registry.gitlab.com/bnp/proj:$VERSION"

Does anyone knows how to fix it please.?

Thank you

like image 236
biwia Avatar asked Nov 05 '20 09:11

biwia


1 Answers

Most of these problems are related to DNS errors.your git runner container can't find out what the ip of git is.I set up the git on a private network and I know what it's IP is. Find Ip of registry.gitlab.com on your network, and add it to /etc/hosts of your runner server.(ex: 123.123.123.123)

123.123.123.123 registry.gitlab.com
like image 184
ali karimi Avatar answered Oct 13 '22 03:10

ali karimi