LoginSignup
97
47

More than 5 years have passed since last update.

debian(jessie)のdocker image使ってるとapt-getでエラーが出る

Last updated at Posted at 2019-03-26

dockerでruby:2.3.1を使ってビルドしようとしたら

W: Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/main/binary-amd64/Packages  404  Not Found

ってエラーが出る

なーぜ?

  • http://deb.debian.org/debian/dists/jessie-updates/main/binary-amd64/Packages が404になる
  • どうやらjessieがアップデートされないからhttp://deb.debian.org/debian/dists/jessie/main/binary-amd64/Packagesに変わったらしい
  • アップデートサボるなよってことなんですねー

とりあえず直す

Dockerfile
FROM ruby:2.3.1

WORKDIR /usr/src/app

RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - &&\
    apt-get update -qq &&\
    apt-get install -y nodejs

みたいなのを

Dockerfile
FROM ruby:2.3.1

WORKDIR /usr/src/app

RUN echo "deb http://deb.debian.org/debian jessie main" > /etc/apt/sources.list &&\
    echo "deb http://security.debian.org jessie/updates main" >> /etc/apt/sources.list &&\
    curl -sL https://deb.nodesource.com/setup_8.x | bash - &&\
    apt-get update -qq &&\
    apt-get install -y nodejs

にする

この修正がなにをしているのか

パッケージのダウンロード元が書かれているファイルが/etc/apt/sources.list
これを元にapt-getが動く

そしてそこには

/etc/apt/sources.list
deb http://deb.debian.org/debian jessie main
deb http://deb.debian.org/debian jessie-updates main
deb http://security.debian.org jessie/updates main

と書かれてる
まぁ見た感じ2行目3行目が悪さしてるっぽいね

だから

deb http://deb.debian.org/debian jessie main
deb http://security.debian.org jessie/updates main

で上書きしてみる
動いた!!

あくまでご参考までに

自分そこまでlinux詳しくないですし
適当に勘で直しただけなのでこれがベストな直し方かと言われると自信ないです

stretchにあげるのが一番いいんじゃないかと

追記 2019/03/28

3行目は消しちゃいけなかったようです
修正しました

@Iju
@henrich
ご指摘頂きありがとうございます

97
47
2

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
97
47