apt-getでvimインストールしようとしたらエラー

ある日突然、dockerfileのbuildでエラーが出るようになりました

dockerfileファイル

エラーになったDockerfile

FROM mysql:5.7

RUN ["apt-get", "update"]
RUN ["apt-get", "install", "-y", "locales"]
RUN ["locale-gen", "ja_JP.UTF-8"]
RUN ["apt-get", "install", "-y", "vim"]

ENV LANG ja_JP.UTF-8
ENV LANGUAGE ja_JP:ja

connectionでエラー

apt-getでvimインストール時に「http://deb.debian.org/debian buster/main」でconnectionエラーが出てます

 => ERROR [5/5] RUN ["apt-get", "install", "-y", "vim"]                                                                                                                     31.8s
------
 > [5/5] RUN ["apt-get", "install", "-y", "vim"]:
#9 0.371 Reading package lists...
#9 1.075 Building dependency tree...
#9 1.209 Reading state information...
#9 1.367 The following additional packages will be installed:
#9 1.367   vim-common vim-runtime xxd
#9 1.369 Suggested packages:
#9 1.369   ctags vim-doc vim-scripts
#9 1.477 The following NEW packages will be installed:
#9 1.477   vim vim-common vim-runtime xxd
#9 31.76 0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
#9 31.76 Need to get 7390 kB of archives.
#9 31.76 After this operation, 33.7 MB of additional disk space will be used.
#9 31.76 Err:1 http://deb.debian.org/debian buster/main amd64 xxd amd64 2:8.1.0875-5
#9 31.76   Could not connect to deb.debian.org:80 (151.101.230.132), connection timed out
#9 31.76 Err:2 http://deb.debian.org/debian buster/main amd64 vim-common all 2:8.1.0875-5
#9 31.76   Unable to connect to deb.debian.org:http:
#9 31.76 Err:3 http://deb.debian.org/debian buster/main amd64 vim-runtime all 2:8.1.0875-5
#9 31.76   Unable to connect to deb.debian.org:http:
#9 31.76 Err:4 http://deb.debian.org/debian buster/main amd64 vim amd64 2:8.1.0875-5
#9 31.76   Unable to connect to deb.debian.org:http:
#9 31.77 E: Failed to fetch http://deb.debian.org/debian/pool/main/v/vim/xxd_8.1.0875-5_amd64.deb  Could not connect to deb.debian.org:80 (151.101.230.132), connection timed out
#9 31.77 E: Failed to fetch http://deb.debian.org/debian/pool/main/v/vim/vim-common_8.1.0875-5_all.deb  Unable to connect to deb.debian.org:http:
#9 31.77 E: Failed to fetch http://deb.debian.org/debian/pool/main/v/vim/vim-runtime_8.1.0875-5_all.deb  Unable to connect to deb.debian.org:http:
#9 31.77 E: Failed to fetch http://deb.debian.org/debian/pool/main/v/vim/vim_8.1.0875-5_amd64.deb  Unable to connect to deb.debian.org:http:
#9 31.77 E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

apt-getからaptに変更してエラー回避

Ubuntu 14.04から「apt-get」ではなく「apt」コマンドが推奨されているので、aptに変更したところエラーが出なくなりました。

ただ、なぜこのタイミングでエラーになったのかは不明です

FROM mysql:5.7

RUN ["apt", "update"]
RUN ["apt", "install", "-y", "locales"]
RUN ["locale-gen", "ja_JP.UTF-8"]
RUN ["apt", "install", "-y", "vim"]

ENV LANG ja_JP.UTF-8
ENV LANGUAGE ja_JP:ja

無事にbuildが通りました

 => [5/5] RUN ["apt", "install", "-y", "vim"]                                                  1.5s
 => exporting to image                                                                           0.1s
 => => exporting layers                                                                        0.1s
 => => writing image sha256:baa858018b059dedb1030d98ce35ad705d471ca0e5f551c1aee1f2ee92b37b6f   0.0s
 => => naming to docker.io/library/mysql:5.7

コメント

タイトルとURLをコピーしました