Sample Header Ad - 728x90

Run multiple commands inside a buildah container separated by the boolean AND (&&) operator from the command line

2 votes
1 answer
1590 views
How can I run multiple commands *inside* a buildah container using bash's boolean AND && operator from the host's command line? Here's an example of my issue that starts from a debian image:
$ buildah pull debian:buster && container=$(buildah from debian:buster)
$ buildah run $container -- apt -y update && apt -y upgrade
Hit:1 http://security.debian.org/debian-security  buster/updates InRelease
Hit:2 http://deb.debian.org/debian  buster InRelease
Hit:3 http://deb.debian.org/debian  buster-updates InRelease
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.
bash: apt: command not found...
Install package 'apt' to provide command 'apt'? [N/y]
My host shell interprets the boolean AND && outside the command for buildah. My expectation is to have the right side of the boolean AND to be run inside the buildah container.
Asked by EarthIsHome (295 rep)
Dec 26, 2020, 01:47 AM
Last activity: Dec 28, 2020, 12:28 PM