docker pullの最大同時ダウンロード数を変更する

最近は楽天モバイルを常用しているのですが,auローミングエリアかつ電波が弱いのもあってADSLの頃よりも遅く不安定な回線です,
更に土日休日,朝昼晩と速度が落ちます.
てことでdocker pullなどは深夜帯にやったりしているのですが最近はそれでも駄目な感じに.

pull時の色々なエラー

なんだかバリエーションに富んだエラーが出て楽しくなってきました.
これは昨日試した時の何度か分です.

error pulling image configuration: download failed after attempts=6: net/http: TLS handshake timeout
EOF
error pulling image configuration: download failed after attempts=6: dial tcp [2600:1f18:2148:bc02:9ace:ab18:c47e:e0a5]:443: i/o timeout
 ✘ sockpuppetbrowser Error Get "https://registry-1.docker.io/v2/": net/http: TLS handshake timeout                                                                                                                                       10.1s
Error response from daemon: Get "https://registry-1.docker.io/v2/": net/http: TLS handshake timeout
 ✘ browser-chrome Error   Head "https://registry-1.docker.io/v2/selenium/standalone-chrome/manifests/4": Get "https://auth.docker.io/token?scope=repository%3Aselenium%2Fstandalone-chrome%3Apull&service=regist...                      23.5s
 ✔ changedetection Pulled
                                                                                                                                       21.3s
Error response from daemon: Head "https://registry-1.docker.io/v2/selenium/standalone-chrome/manifests/4": Get "https://auth.docker.io/token?scope=repository%3Aselenium%2Fstandalone-chrome%3Apull&service=registry.docker.io": net/http: requ
est canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
error pulling image configuration: download failed after attempts=6: net/http: TLS handshake timeout
Get "https://registry-1.docker.io/v2/selenium/standalone-chrome/manifests/sha256:553ff18c2055bc2134cd833211c352d601d91f43fd42a7559f94a28eba96a504": EOF
Get "https://registry-1.docker.io/v2/selenium/standalone-chrome/manifests/sha256:553ff18c2055bc2134cd833211c352d601d91f43fd42a7559f94a28eba96a504": EOF
dial tcp: lookup auth.docker.io: Temporary failure in name resolution
error pulling image configuration: download failed after attempts=6: dial tcp: lookup registry-1.docker.io: i/o timeout
error pulling image configuration: download failed after attempts=6: dial tcp: lookup registry-1.docker.io: i/o timeout
 ✘ sockpuppetbrowser Error Get "https://registry-1.docker.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)                                                              15.0s
 ! browser-chrome          Interrupted                                                                                                                                                                                                   15.0s
 ! changedetection         Interrupted                                                                                                                                                                                                   17.3s
Error response from daemon: Get "https://registry-1.docker.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
Get "https://registry-1.docker.io/v2/selenium/standalone-chrome/blobs/sha256:e34a67f89d25bc77130abb059c42a2c47d18fd489056fa50da057d4b51507fac": dial tcp: lookup registry-1.docker.io: i/o timeout

ダウンロード並列数を変更する

ダウンロードは複数並列で動き,失敗したコンテナは再実行時始めら開始されます.
以下のように結構いいとこまで行っても失敗するとまたはじめからで悲しいです.

   ⠹ e34a67f89d25 Downloading [========================================>          ]  131.6MB/164.3MB                                                                                                                                    284.2s

ということでダウンロード並列数を減らしたり, wget -continue のようにダウンロード途中から再開する機能が欲しいところ.

検索して以下のページに --max-concurrent-downloads というオプションが紹介されていました.

設定ファイルに書くこともできるようです.

この設定でダウンロード並列数を既定値の3から1にしてみます.

/etc/docker/daemon.json を編集,存在しない場合は新規作成して同時ダウンロード数を1にしてデーモンを再起動しました.

$ ls -lA /etc/docker/ (1)
合計 8
-rw------- 1 root root 244  7月 19  2024 key.json
$ umask 0077 (2)
$ umask
0077
$ echo '{
    "max-concur-downloads": 1
}' | sudo tee /etc/docker/daemon.json (3)
{
    "max-concurrent-downloads": 1
}
$ ls -lA /etc/docker/
合計 8
-rw------- 1 root root  38  8月 21 07:01 daemon.json
-rw------- 1 root root 244  7月 19  2024 key.json
$ sudo systemctl restart docker (4)
  1. daemon.json は存在しない状態

  2. 他のファイルとパーミッションを合わせるためにumaskを設定

  3. ダウンロード並列数を1にする設定をdaemon.jsonに

  4. dockerデーモン再起動

デーモン再起動後再度pullを試みると最後まで動作しました.

$ docker compose --file ./docker-compose.yml pull
[+] Pulling 43/43
 ✔ sockpuppetbrowser Pulled                                                                                                                                                                                                               3.5s
 ✔ browser-chrome Pulled                                                                                                                                                                                                               1394.0s
   ✔ b71466b94f26 Already exists                                                                                                                                                                                                          0.0s
   ✔ e34a67f89d25 Already exists                                                                                                                                                                                                          0.0s
   ✔ 75d85e0261db Already exists                                                                                                                                                                                                          0.0s
   ✔ 939d8ca73113 Already exists                                                                                                                                                                                                          0.0s
   ✔ 6186010a47ee Already exists                                                                                                                                                                                                          0.0s
   ✔ 27714f768b43 Already exists                                                                                                                                                                                                          0.0s
   ✔ 916b96ca33ba Already exists                                                                                                                                                                                                          0.0s
   ✔ 04aa3410ccc8 Already exists                                                                                                                                                                                                          0.0s
   ✔ bdb59075b1d5 Already exists                                                                                                                                                                                                          0.0s
   ✔ 2df770ff8fc0 Already exists                                                                                                                                                                                                          0.0s
   ✔ 54ac28d956cc Already exists                                                                                                                                                                                                          0.0s
   ✔ c44f6dc55fed Already exists                                                                                                                                                                                                          0.0s
   ✔ 5aff9b4a47b1 Already exists                                                                                                                                                                                                          0.0s
   ✔ b1b7bf4d2165 Already exists                                                                                                                                                                                                          0.0s
   ✔ 24f77931a43f Already exists                                                                                                                                                                                                          0.0s
   ✔ 6c2a20e23e29 Already exists                                                                                                                                                                                                          0.0s
   ✔ 1876ab010adb Already exists                                                                                                                                                                                                          0.0s
   ✔ 3e2e63824644 Already exists                                                                                                                                                                                                          0.0s
   ✔ 422e43c124fc Already exists                                                                                                                                                                                                          0.0s
   ✔ 2f170438d2dd Already exists                                                                                                                                                                                                          0.0s
   ✔ b2b509664d5c Pull complete                                                                                                                                                                                                         649.2s
   ✔ d1699bb66466 Pull complete                                                                                                                                                                                                         815.8s
   ✔ 5c8f9ce7ebce Pull complete                                                                                                                                                                                                         821.8s
   ✔ 597064b9d874 Pull complete                                                                                                                                                                                                         826.8s
   ✔ 34893f441ecf Pull complete                                                                                                                                                                                                         828.3s
   ✔ 9e5143f86271 Pull complete                                                                                                                                                                                                         829.8s
   ✔ 84388cffd066 Pull complete                                                                                                                                                                                                         840.2s
   ✔ 9d6965976ee5 Pull complete                                                                                                                                                                                                        1322.8s
   ✔ 2046aa7c3ddc Pull complete                                                                                                                                                                                                        1322.8s
   ✔ c834abc7e6bf Pull complete                                                                                                                                                                                                        1323.3s
   ✔ 23f3e15ccb79 Pull complete                                                                                                                                                                                                        1324.8s
   ✔ 57a77ef3c897 Pull complete                                                                                                                                                                                                        1353.7s
   ✔ b38fd1040849 Pull complete                                                                                                                                                                                                        1368.1s
   ✔ 18fd3cb83a78 Pull complete                                                                                                                                                                                                        1380.9s
   ✔ ce86c34af927 Pull complete                                                                                                                                                                                                        1383.7s
   ✔ 6efed1a6a8f0 Pull complete                                                                                                                                                                                                        1385.1s
   ✔ 9fc8549fc5d4 Pull complete                                                                                                                                                                                                        1386.5s
   ✔ 1b3b81dbe4ce Pull complete                                                                                                                                                                                                        1388.0s
   ✔ acbe3debc1b0 Pull complete                                                                                                                                                                                                        1389.3s
   ✔ 2b0eb12e590f Pull complete                                                                                                                                                                                                        1390.6s
 ✔ changedetection Pulled
 ----

ということで2日くらい失敗を繰り返していたpullが1回で通りました.
しばらくはこの設定のままにしておこうと思います.


.環境

$ dpkg-query -W docker.io bash
bash 5.2.37-2+b5
docker.io 26.1.5+dfsg1-4+b1
$ lsb_release -dr
Description: Debian GNU/Linux forky/sid
Release: n/a
$ arch
x86_64

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です