When attempting a build, the apt-add-repository command appears to execute, but the new repository is not showing up in the updated list and the app to be installed isn’t being found. When the exact same command is run in an interactive session with a container using the image (with the single command commented so the build will complete), the sources list is being updated correctly and the install works normally.
NOTE - where {URL} appears below is
http://deb.debian.org/debian
It has been replaced due to form filtering rules.
In Dockerfile -
RUN dpkg --add-architecture i386 \
&& add-apt-repository -y -n -U {URL} -c contrib -c non-free \
&& apt update \
&& apt install -y steamcmd
And the output -
[5/6] RUN dpkg --add-architecture i386 && add-apt-repository -y -n -U {URL} -c contrib -c non-free && apt update && apt install -y steamcmd:
0.310 Repository: 'deb {URL} bookworm non-free contrib'
0.310 Description:
0.310 Archive for codename: bookworm components: non-free,contrib
0.310 More info: {URL}
0.310 Adding repository.
0.310 Adding deb entry to /etc/apt/sources.list.d/archive_uri-http_deb_debian_org_debian-bookworm.list
0.310 Adding disabled deb-src entry to /etc/apt/sources.list.d/archive_uri-http_deb_debian_org_debian-bookworm.list
0.322
0.322 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
0.322
0.361 Hit:1 {URL} stable InRelease
0.361 Hit:2 {URL} stable-updates InRelease
0.361 Hit:3 {URL}-security stable-security InRelease
0.663 Reading package lists...
1.264 Building dependency tree...
1.414 Reading state information...
1.431 All packages are up to date.
1.437
1.437 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
1.437
1.438 Reading package lists...
2.029 Building dependency tree...
2.181 Reading state information...
2.187 E: Unable to locate package steamcmd
Executed in the container
dpkg --add-architecture i386 && add-apt-repository -y -n -U {URL} -c contrib -c non-free && apt update && apt install -y steamcmd
Output
*Repository: 'deb {URL} bookworm contrib non-free'*
*Description:*
*Archive for codename: bookworm components: contrib,non-free*
*More info: {URL}*
*Adding repository.*
*Adding deb entry to /etc/apt/sources.list.d/archive_uri-http_deb_debian_org_debian-bookworm.list*
*Adding disabled deb-src entry to /etc/apt/sources.list.d/archive_uri-http_deb_debian_org_debian-bookworm.list*
*Get:1 {URL} bookworm InRelease [151 kB]*
*Hit:2 {URL} stable InRelease*
*Hit:3 {URL} stable-updates InRelease*
*Hit:4 {URL}-security stable-security InRelease*
*Get:5 {URL} bookworm/contrib i386 Packages [46.6 kB]*
*Get:6 {URL} bookworm/non-free amd64 Packages [97.3 kB]*
*Get:7 {URL} bookworm/contrib amd64 Packages [54.1 kB]*
*Get:8 {URL} bookworm/non-free i386 Packages [73.4 kB]*
*Fetched 435 kB in 0s (1945 kB/s)*
*Reading package lists... Done*
*Building dependency tree... Done*
*Reading state information... Done*
*All packages are up to date.*
*Reading package lists... Done*
*Building dependency tree... Done*
*Reading state information... Done*
*The following additional packages will be installed:*
* gcc-12-base:i386 libc6:i386 libgcc-s1:i386 libstdc++6:i386*
…And the app installs correctly.
To make the image build, the only change I am making is commenting out the last “apt install” command. From the console logs, it looks like the issue is in the apt-add-repository command, as I’m only seeing the default 3 Hit messages after adding the repository, and not the additional Get messages. This “RUN dpkg” command string is the last thing being done in the Dockerfile other than setting the WORKDIR. I believe I’ve removed every possible variable at this point other than the command being run during build rather than being run in the container.