How to install gcc-9 on debian:latest docker
From a fresh start of debian:10
:
echo 'deb http://deb.debian.org/debian testing main' > /etc/apt/sources.list.d/testing.listapt updatecat <<EOF > /etc/apt/preferences.d/pinPackage: *Pin: release a=stablePin-Priority: 700Package: *Pin: release a=testingPin-Priority: 650EOFapt install -qq -y -t testing build-essential
yields:
# g++ -vgcc version 9.3.0 (Debian 9.3.0-11)
In my Dockerfile I did:
FROM debian:latest AS env...RUN echo 'deb http://deb.debian.org/debian testing main' >> /etc/apt/sources.listRUN apt update -yRUN apt install -y gcc
note: I added these line after the install of build-essential
so technically the container install the "default" gcc then it is updated by the one in the testing repo...
note2: Using RUN gcc --version
I've got gcc (Debian 9.3.0-11) 9.3.0
:D