Failed to fetch jessie backports repository

Wheezy and Jessie were recently removed from the mirror network, so if you want to continue fetching Jessie backports, you need to use archive.debian.org instead:

deb [check-valid-until=no] http://archive.debian.org/debian jessie-backports main

(Validity checks need to be disabled since the repository is no longer being updated. Jessie’s apt doesn’t support the check-valid-until flag, see inostia’s answer for details, and the configuration summary further down in this answer.)

The jessie-updates repository has been removed: all the updates have been merged with the main repository, and there will be no further non-security updates. So any references to jessie-updates in sources.list or sources.list.d files need to be removed. Security updates will continue to be provided, on LTS-supported architectures, in the security repository, until June 30, 2020.

Since you’re building a container image, I highly recommend basing it on Debian 9 (Stretch) instead. To stay on Debian 8 (Jessie), your repositories should end up looking like

deb http://cdn-fastly.deb.debian.org/debian/ jessie main
deb-src http://cdn-fastly.deb.debian.org/debian/ jessie main

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

deb http://archive.debian.org/debian jessie-backports main
deb-src http://archive.debian.org/debian jessie-backports main

(without the jessie-updates repository).

You’ll also need to disable validity checks in /etc/apt/apt.conf (which will apply to all repositories):

Acquire::Check-Valid-Until "false";

After trying solutions suggested by @inostia and @Stephen Kitt I was still getting the following error:

W: Failed to fetch http://deb.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.

I figured out that it can be solved by removing the line deb http://deb.debian.org/debian jessie-updates main from /etc/apt/sources.list.

I ended up with the following snippet in my Dockerfile:

RUN echo "deb [check-valid-until=no] http://cdn-fastly.deb.debian.org/debian jessie main" > /etc/apt/sources.list.d/jessie.list
RUN echo "deb [check-valid-until=no] http://archive.debian.org/debian jessie-backports main" > /etc/apt/sources.list.d/jessie-backports.list
RUN sed -i '/deb http:\/\/deb.debian.org\/debian jessie-updates main/d' /etc/apt/sources.list
RUN apt-get -o Acquire::Check-Valid-Until=false update

This happened to me provisioning a Vagrant box that was using Debian "Jessie".

Following Stephen Kitt's answer, switching to archive.debian.org worked for me, but I had to add it to /etc/apt/sources.list.d/jessie-backports.list, rather than to /etc/apt/sources.list.

I added the following line to provision.sh:

echo "deb http://archive.debian.org/debian jessie-backports main" > /etc/apt/sources.list.d/jessie-backports.list

I then also got a security error running apt-get update.

Following How to work around "Release file expired" problem on a local mirror, this fixed that error:

apt-get -o Acquire::Check-Valid-Until=false update

Alternatively, to disable checks permanently, add this to provision.sh:

echo "Acquire::Check-Valid-Until \"false\";" > /etc/apt/apt.conf.d/100disablechecks

Then you can run all apt commands without the -o flag.