Docker: How to add backports to sources.list via Dockerfile?

user3142695 picture user3142695 · Sep 25, 2017 · Viewed 18.5k times · Source

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"]

Answer

Tarun Lalwani picture Tarun Lalwani · Sep 25, 2017

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