Edited at

Dockerfileの中での apt-get update / apt-get install の不整合

More than 3 years have passed since last update.


こんなことありませんか

Dockerfile からのbuildを行っていて

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/m/mysql-5.5/mysql-client-core-5.5_5.5.41-0ubuntu0.14.04.1_amd64.deb: 404  Not Found [IP: 91.189.91.24 80]

と表示され、「そんなはずはない!俺はちゃんとapt-get updateしてる!ほら見ろ!」


Dockerfile

FROM ubuntu:14.04

RUN apt-get update -q -y
RUN apt-get install -y build-essential curl nginx
(略)
RUN apt-get install -y mysql-client



解決策

dockerのキャッシュを破棄するしかない気がします。

docker build --no-cache .


原因

apt-get update をした時点でのパッケージの情報が記録されたイメージを、月日が経ってからキャッシュとして利用したため。RUN apt-get install -y mysql-client を実行した時点でのレポジトリとの構成が不整合になっている。


追記

The following packages have unmet dependencies:

build-essential : Depends: libc6-dev but it is not going to be installed or
libc-dev
Depends: g++ (>= 4:4.4.3) but it is not going to be installed
libbz2-dev : Depends: libc6-dev but it is not going to be installed or
libc-dev
libcurl4-gnutls-dev : Depends: libc6-dev but it is not going to be installed or
libc-dev
Depends: libgnutls-dev but it is not going to be installed
Depends: libkrb5-dev but it is not going to be installed
Depends: librtmp-dev but it is not going to be installed
Depends: zlib1g-dev but it is not going to be installed
libfreetype6-dev : Depends: libc6-dev but it is not going to be installed or
libc-dev
Depends: zlib1g-dev but it is not going to be installed or
libz-dev
libjpeg-dev : Depends: libjpeg8-dev but it is not going to be installed
libmysqlclient-dev : Depends: zlib1g-dev but it is not going to be installed
libpng12-dev : Depends: zlib1g-dev but it is not going to be installed
libssl-dev : Depends: libssl1.0.0 (= 1.0.1f-1ubuntu2) but 1.0.1f-1ubuntu2.11 is to be installed
Depends: zlib1g-dev but it is not going to be installed
Recommends: libssl-doc but it is not going to be installed

こちらも同様の原因と対処となりますので、よろしくご査収お願いします。