質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.31%
Ubuntu

Ubuntuは、Debian GNU/Linuxを基盤としたフリーのオペレーティングシステムです。

Docker

Dockerは、Docker社が開発したオープンソースのコンテナー管理ソフトウェアの1つです

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

Q&A

解決済

1回答

642閲覧

Dockerでubuntu・pythonをビルドした時のエラー

ryo_732

総合スコア1

Ubuntu

Ubuntuは、Debian GNU/Linuxを基盤としたフリーのオペレーティングシステムです。

Docker

Dockerは、Docker社が開発したオープンソースのコンテナー管理ソフトウェアの1つです

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

0グッド

0クリップ

投稿2024/03/04 18:22

編集2024/03/05 01:45

実現したいこと

Dockerでubuntu・pythonを導入した環境を構築したいです。

【環境】
Windows10
Docker Desktop 4.28.0

発生している問題・分からないこと

「docker build -t myapp:1.0 .」を実行するとエラーが出てしまい、イメージが作成できません。

数ヶ月前は普通にできていたので、なぜできなくなったのかが、不明です。
また、PaasサービスであるRailwayでのビルドはうまく行くようなので、ローカルのみおかしいようです。

当方、初心者のためわからない事が多く(特にDocker関連)初心者でもわかるように教えていただけると幸いです。。。

エラーメッセージ

error

1なぜか、下記の二通りのエラーがランダムに出ます(条件は変えなくても) 2 3ーーーーパターン1ーーーー 4385.8 Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/liba/libauthen-sasl-perl/libauthen-sasl-perl_2.1600-1_all.deb 403 connecting to archive.ubuntu.com:80: connecting to 91.189.91.82:80: dial 5tcp 91.189.91.82:80: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. [IP: 185.125.190.36 80] 6385.8 E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing? 7------ 8-------------------- 9 13 | #install google-chrome 10 14 | >>> RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add && \ 11t/sources.list.d/google-chrome.list && \ 12 16 | >>> apt-get update && \ 13 17 | >>> apt-get install -y google-chrome-stable 14 18 | 15-------------------- 16ERROR: failed to solve: process "/bin/sh -c wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add && echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | tee /etc/apt/sources.list.d/google-chrome.list && apt-get update && apt-get install -y google-chrome-stable" did not complete successfully: exit code: 100 17ーーーーーーーーーーーーー 18 19 20 21ーーーーパターン2ーーーー 22205.4 E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/n/npth/libnpth0_1.6-1_amd64.deb 403 connecting to archive.ubuntu.com:80: connecting to 91.189.91.81:80: dial tcp 91.189.91.81:80: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. [IP: 185.125.190.205.4 E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing? 23205.4 Fetched 71.6 MB in 3min 22s (355 kB/s) 24------ 25Dockerfile:8 26-------------------- 27 6 | RUN apt upgrade -y 28 7 | RUN apt install -y python3.9 29 8 | >>> RUN apt install -y python3-pip 30 9 | RUN apt install -y wget 31 10 | 32ERROR: failed to solve: process "/bin/sh -c apt install -y python3-pip" did not complete successfully: 33exit code: 100 34ーーーーーーーーーーーーー

該当のソースコード

Dockerfile

1FROM ubuntu:focal 2USER root 3 4RUN apt update 5RUN apt upgrade -y 6RUN apt install -y python3.9 7RUN apt install -y python3-pip 8RUN apt install -y wget 9 10RUN apt-get update && apt-get install -y unzip 11 12#install google-chrome 13RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add && \ 14 echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | tee /etc/apt/sources.list.d/google-chrome.list && \ 15 apt-get update && \ 16 apt-get install -y google-chrome-stable 17 18 19#install ChromeDriver 20# バージョン指定あり 21ADD https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.96/linux64/chrome-linux64.zip /opt/chrome/ 22RUN cd /opt/chrome/ && \ 23 unzip chrome-linux64.zip 24 25ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/chrome 26 27COPY requirements.txt . 28RUN python3.9 -m pip install -r requirements.txt 29 30WORKDIR /var 31 32COPY script.py . 33COPY settings.yaml . 34 35ENTRYPOINT ["python3.9", "script.py"]

試したこと・調べたこと

  • teratailやGoogle等で検索した
  • ソースコードを自分なりに変更した
  • 知人に聞いた
  • その他
上記の詳細・結果

・Docker Desktopのバージョンアップ
・Docker Desktopの再インストール
・PCの再起動
・ChatGPT4などに質問
・(残量が少なかったので)HDDを100GB以上開ける
・「docker builder prune -f」でキャッシュ削除

⇒問題変わらず

補足

特になし

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

自己解決しました。
何が決め手かはわかりませんでしたが、下記を実施したら、特にコード変更しなくてもビルドできるようになりました。

・数日置いた
・再インストールしたDocker Desktopが最新バージョンになっていなかったので、最新バージョンへアップデート
・PCを再起動

お騒がせしました。

投稿2024/03/09 07:28

ryo_732

総合スコア1

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.31%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問