0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

[Docker]dockerコマンドの時だけ発生するエラーに苦しんだ

Posted at

本記事では、エラーの内容と解決した方法のみ記載してます。

環境
ubuntu 18.04
Docker 24.0.2
docker-compose 1.29.0

いつエラーが発生したのか

Proxy環境下でDockerイメージをpullしたとき

エラー詳細

エラーはDockerfileのFROMの行で発生しており、内容は下記の通り

ERROR: failed to solve: python:3.9.7-slim-buster: failed to authorize: failed to fetch   
anonymous token: Get "https://auth.docker.io/token?scope=repository%3Alibrary%2Fpython%3Apull&service=registry.docker.io": read tcp x.x.x.x->x.x.x.x:443: read: connection reset by peer

エラーについて色々試した結果

「どうせプロキシ周りだろう」と思い色々調べていくとどうやらdockerコマンドで実行した時だけエラーが発生していた。
docker-composeでイメージを作成する時はエラーが発生しない。

$ docker pull alpine // NG
// docker-compose.yaml
version: '3'
services:
  alpine_container:
    image: alpine
    container_name: my_alpine_container
    command: tail -f /dev/null
$ docker-compose up --build // OK

解決方法

Dockerのバージョンを下げることで解決した。具体的には20.10.24をインストールした。
docker-composeのバージョンと異なりDockerは比較的新しかったので変えてみるとすんなり動いた。

強引な方法だがとりあえず解決したので良しとしておこう。
同じ状況で困っている方は一度バージョンを変えてみても良いかも知れない。

おまけ

初めてアプリをリリースしました
https://t.co/TM0EsZKOWi

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?