While attempting to build an image via Buildah from CentOS:latest, yum wouldn't complete commands due to "no URLs in mirrorlist," so I added the following to the Dockerfile
RUN sed -i -e "s;mirrorlist=;#mirrorlist=;g" -e "s;#baseurl=http://mirror;baseurl=http://vault;g" /etc/yum.repos.d/CentOS-Linux*
which worked flawlessly.
Afterwards, while experimenting with running the same command in a container directly, the following error was presented:
[ec2-user@ip-172-31-32-232 buildah]$ buildah run centos-working-container sed -i -e "s;mirrorlist=;#mirrorlist=;g" -e "s;#baseurl=http://mirror;baseurl=http://vault;g" /etc/yum.repos.d/CentOS-Linux*
/usr/bin/sed: can't read /etc/yum.repos.d/CentOS-Linux*: No such file or directory
Error: while running runtime: exit status 2
This forced me to run the command manually across CentOS-Linux-Appstream.repo, CentOS-Linux-BaseOS.repo, etc
- Tripled checked spelling and directly copied exact command from Dockerfile.
- Tested the command on local CentOS VM (it worked normally).