5
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

日本情報クリエイト Engineer'sAdvent Calendar 2017

Day 10

Dockerでphp:5.4-fpmでapt-get updateでエラー

Last updated at Posted at 2019-03-28

php:5.4-fpmでapt-get updateを行うとエラーになった

$ docker run -it --rm php:5.4-fpm apt-get update
Get:1 http://security.debian.org jessie/updates InRelease [44.9 kB]
Get:2 http://security.debian.org jessie/updates/main amd64 Packages [824 kB]      
Ign http://httpredir.debian.org jessie InRelease                                                                                                                                                                                                                                                                             
Ign http://httpredir.debian.org jessie-updates InRelease
Get:3 http://httpredir.debian.org jessie Release.gpg [2420 B]
Ign http://httpredir.debian.org jessie-updates Release.gpg   
Get:4 http://httpredir.debian.org jessie Release [148 kB]
Ign http://httpredir.debian.org jessie-updates Release
Get:5 http://httpredir.debian.org jessie/main amd64 Packages [9098 kB]
Err http://httpredir.debian.org jessie-updates/main amd64 Packages
  
Err http://httpredir.debian.org jessie-updates/main amd64 Packages
  
Err http://httpredir.debian.org jessie-updates/main amd64 Packages
  
Err http://httpredir.debian.org jessie-updates/main amd64 Packages
  
Err http://httpredir.debian.org jessie-updates/main amd64 Packages
  404  Not Found
Fetched 10.1 MB in 30s (327 kB/s)
W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie-updates/main/binary-amd64/Packages  404  Not Found

E: Some index files failed to download. They have been ignored, or old ones used instead.

どうやら /etc/apt/sources.list の中身が古い?ようなので php:5.6-fpm の内容を上書きしてやる

まず 5.6-fpm の内容を取得

$ docker run -it --rm php:5.6-fpm cat /etc/apt/sources.list
deb http://deb.debian.org/debian stretch main
deb http://security.debian.org/debian-security stretch/updates main
deb http://deb.debian.org/debian stretch-updates main

こいつを /etc/apt/sources.list に書き込んでやれば何か警告は出るけどもとりあえず通った

$ docker run -it --rm php:5.4-fpm /bin/bash -c 'echo "deb http://deb.debian.org/debian stretch main" > /etc/apt/sources.list;
> echo "deb http://security.debian.org/debian-security stretch/updates main" >> /etc/apt/sources.list;
> echo "deb http://deb.debian.org/debian stretch-updates main" >> /etc/apt/sources.list;
> apt-get update;'
Get:1 http://security.debian.org stretch/updates InRelease [94.3 kB]
Ign http://deb.debian.org stretch InRelease
Get:2 http://deb.debian.org stretch-updates InRelease [91.0 kB]
Get:3 http://deb.debian.org stretch Release.gpg [2434 B]                            
Get:4 http://deb.debian.org stretch Release [118 kB]                       
Get:5 http://security.debian.org stretch/updates/main amd64 Packages [601 kB] 
Get:6 http://deb.debian.org stretch-updates/main amd64 Packages [12.2 kB]       
Get:7 http://deb.debian.org stretch/main amd64 Packages [9478 kB]                        
Fetched 10.4 MB in 11s (911 kB/s)                                                                                                                                                                                                                                                                                            
Reading package lists... Done
W: There is no public key available for the following key IDs:
EF0F382A1A7B6500

Dockerfile に書く場合は下記の感じ

RUN echo "deb http://deb.debian.org/debian stretch main" > /etc/apt/sources.list \
    echo "deb http://security.debian.org/debian-security stretch/updates main" >> /etc/apt/sources.list \
    echo "deb http://deb.debian.org/debian stretch-updates main" >> /etc/apt/sources.list
RUN apt-get update

参考にしたサイト
https://qiita.com/rh_taro/items/40373a30ead444ae9ca7
https://github.com/tianon/docker-brew-debian/issues/31

5
3
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
5
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?