iT邦幫忙

2021 iThome 鐵人賽

DAY 14
0
自我挑戰組

轉職未滿一年的點點滴滴系列 第 14

[Day 14] - 『轉職工作的Lessons learned』 - Docker Build Issue

  • 分享至 

  • xImage
  •  

今天的筆記應該算是日常初階工程師會發生的問題,以及可以怎麼去找根因的一些做法,不外乎就是下好關鍵字,然後去實驗網路上的solution是否可以解答我的情況。

Dockerfile Build Issue

近期工作發生了這個issue,當我在local環境使用docker去build一個image檔時,卻發生了以下的Issue

❯ docker build -t test3/test3 .
[+] Building 9.7s (2/3)                                                           
 => [internal] load build definition from Dockerfile                         0.0s
 => => transferring dockerfile: 37B                                          0.0s
[+] Building 10.3s (3/3) FINISHED                                      => [internal] load build definition from Dockerfile             0.0s
 => => transferring dockerfile: 37B                              0.0s  => [internal] load .dockerignore                                0.0s
 => => transferring context: 2B                                  0.0s  => ERROR [internal] load metadata for docker.io/library/node:  10.2s
------
 > [internal] load metadata for docker.io/library/node:14-alpine:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: failed to do request: Head https://registry-1.docker.io/v2/library/node/manifests/14-alpine: net/http: TLS handshake timeout

Local docker build

關鍵字:failed to solve with frontend dockerfile.v0

利用以上關鍵字找到了一篇stackoverflow當中的solution有寫道:
DOCKER_BUILDKIT=0 docker build .可以更精確的知道錯誤是什麼(參考網址

實際command後出現以下問題,可能是TLS timeout 問題。

❯ DOCKER_BUILDKIT=0  docker build .
Sending build context to Docker daemon  130.6MB
Step 1/12 : FROM node:14-alpine
Get https://registry-1.docker.io/v2/: net/http: TLS handshake timeout

關鍵字:Get https://registry-1.docker.io/v2/: net/http: TLS handshake timeout

後續在例用以上關鍵字去搜索,找到了以下的解釋:

net/http: TLS handshake timeout means that you have slow internet connection. Default value of connection timeout is too small for your environment. Unfortunately docker don't have any settings that allows you change connection timeout. You may try to create your own registry cache somewhere else and pull images from it.
(net/http: TLS handshake timeout意味著您的互聯網連接速度較慢。連接超時的默認值對於您的環境來說太小了。不幸的是,docker 沒有任何允許您更改連接超時的設置。您可以嘗試在其他地方創建自己的註冊表緩存並從中提取圖像。)(參考網址

Solution (參考網址)

  1. Check internet speed and connect to Faster Internet
    => it works!!!!!!!!

  2. Restart Docker
    => Useless

  3. Reset Daemon Settings
    => To be check...


Gitlab docker build

關鍵字: gitlab cicd pending at fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz

issue is related to Alpine image having networking issues when run in Docker-in-Docker configuration on Kubernetes/OpenShift based runner.
(發現此問題與在基於 Kubernetes/OpenShift 的運行器上以 Docker-in-Docker 配置運行時存在網絡問題的 Alpine 映像有關。)

apk fetch hangs #307

Gitlab.com CI/CD stuck

2021-09-25: Outbound network connectivity issues on CI runners

Solution

  1. Append --network host to the build command
    => Added it to docker client commands,docker build --network host. Modify .gitlab-ci.yaml file to have docker build --network host

  2. Google working on it...

Test failures starting 22 September due to network timeouts #23741

After reviewing the information you provided, we believe that you may be affected by a known issue: We have identified a Networking connecting issue impacting the GKE Docker workload. This is a high priority issue that we're working to resolve as soon as possible. Some customers may be experiencing a connection failure in Docker workflow to Fastly destinations and may receive a timeout error.
(在查看您提供的信息後,我們認為您可能受到一個已知問題的影響:我們發現了一個影響 GKE Docker 工作負載的網絡連接問題。 這是一個高度優先的問題,我們正在努力盡快解決。 一些客戶可能會在 Docker 工作流中遇到 Fastly 目標的連接失敗,並且可能會收到超時錯誤。)

Google Cloud incident

Global: We have identified a Networking connectivity issue that impacts Docker workloads inside GKE and potentially GC(全球:我們發現了一個網絡連接問題,該問題會影響 GKE 內的 Docker 工作負載並可能影響 GC)

Try and Error
3. Specify specific version of alpine and comment out RUN apk update
=> it works


上一篇
[Day 13] -『 GO語言學習筆記』- 核心型別(I)
下一篇
[Day 15] -『 GO語言學習筆記』- 核心型別(II)
系列文
轉職未滿一年的點點滴滴30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言