9

I need to install ffmeg on debian jessie via Dockerfile.

Debian recommends to use backports. But how do I do this in my Dockerfile?

Add

deb http://httpredir.debian.org/debian jessie-backports main non-free
deb-src http://httpredir.debian.org/debian jessie-backports main non-free

to

/etc/apt/sources.list

This is how my Dockerfile looks like:

FROM node:4.8-slim

COPY . /

## How to add backports to list ???

RUN apt-get update && apt-get install ffmpeg && ffmpeg -i

RUN (cd programs/server && npm install --silent)
CMD ["node", "main.js"]
user3142695
  • 11,619
  • 29
  • 119
  • 238
  • Related: [How to add repository from shell in Debian](https://unix.stackexchange.com/questions/45879/how-to-add-repository-from-shell-in-debian) – Mark Plotnick Sep 25 '17 at 15:55

3 Answers3

20

You can do it by adding below

RUN printf "deb http://httpredir.debian.org/debian jessie-backports main non-free\ndeb-src http://httpredir.debian.org/debian jessie-backports main non-free" > /etc/apt/sources.list.d/backports.list
Tarun Lalwani
  • 124,930
  • 8
  • 149
  • 214
4

Looking for the same issue I have seen that Debian provides Docker images for backport versions. So you do not need to do that yourself. For instance you can have a jessie backports Dockerfile using FROM debian:jessie-backports command.

By looking at what one of the Debian official backport files do to have the backport version it boils down to something similar to what Tarun's asnwer, using the base distribution then appending the backports to a specific backports.list, i.e.:

FROM debian:jessie
RUN echo 'deb http://deb.debian.org/debian jessie-backports main' > /etc/apt/sources.list.d/backports.list
Eduardo
  • 3,932
  • 2
  • 42
  • 56
0

Tested on Ubuntu 20.04, >> is required when appending to sources.list.

RUN echo 'deb http://deb.debian.org jessie-backports main' >> /etc/apt/sources.list

Other answers create a new flie in /etc/apt/sources.list.d which is OK, but the original question refers to appending to sources.list. Use >> to append to a file.

vanboom
  • 1,107
  • 10
  • 17