■ はじめに
Docker によるトラブルシューティングを纏める。 なお、Windows / Docker Desktop でのトラブルシューティングに関しては 以下の関連記事を参照のこと。
https://dk521123.hatenablog.com/entry/2020/12/11/115814
https://dk521123.hatenablog.com/entry/2020/12/18/152949
目次
【1】docker 実行後、apt-get updateでエラー「Release file is not yet valid」表示 【2】コマンド「docker pull centos:latest」を実行後にエラー表示
【1】docker 実行後、apt-get updateでエラー「Release file is not yet valid」表示
以下のDocker ファイルで、 3行目「RUN apt-get update」を実行した際に 以下「エラー内容」が表示される
Dockerfile
FROM ubuntu:latest RUN apt-get update RUN apt-get install python3 python3-pip -y RUN pip install --trusted-host pypi.python.org -r requirements.txt RUN mkdir /app
エラー内容
・・・略・・・ Get:8 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [177 kB] Reading package lists... E: Release file for http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease is not valid yet (invalid for another 22h 27min 59s). Updates for this repository will not be applied. E: Release file for http://archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease is not valid yet (invalid for another 22h 28min 11s). Updates for this repository will not be applied. E: Release file for http://archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease is not valid yet (invalid for another 22h 28min 33s). Updates for this repository will not be applied. ERROR: Service 'app' failed to build : The command '/bin/sh -c apt-get update' returned a non-zero code: 100
原因
* Docker デーモンが動いているホストの時刻がずれているため
解決策
* 以下のように修正
Dockerfile(修正版)
FROM ubuntu:latest RUN apt-get -o Acquire::Check-Valid-Until=false -o Acquire::Check-Date=false update && apt-get install python3 python3-pip -y WORKDIR /code ADD requirements.txt /code RUN pip3 install -r requirements.txt RUN mkdir /app
参考文献
https://www.hamayanhamayan.com/entry/2020/03/14/113729
【2】コマンド「docker pull centos:latest」を実行後にエラー表示
エラー内容
docker: 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).
解決策
* Dockerアイコンを右クリックし、[Settings]-[Network]で DNS Server での設定のAutomaticを止めて、Fixedの8.8.8.8に切り替える
参考文献
http://satoyashiki.hatenablog.com/entry/2017/04/01/1756
関連記事
Docker ~ 基礎知識編 ~
https://dk521123.hatenablog.com/entry/2020/04/24/160044
Docker ~ Windows / 環境構築編 ~
https://dk521123.hatenablog.com/entry/2017/09/23/235818
Docker ~ 基本編 / docker-compose.yml ~
https://dk521123.hatenablog.com/entry/2020/12/18/152949
Windows / Docker Desktop でのトラブルシューティング
https://dk521123.hatenablog.com/entry/2020/12/11/115814