Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

2 votes
1 answers
2007 views
Building an image with buildah I'm getting: EMFILE: too many open files
When I run `buildah bud`, I'm getting the following error. ```text npm ERR! code EMFILE npm ERR! syscall open npm ERR! path /root/.npm/_cacache/index-v5/cd/a5/aca06eccd914d83e3be09412f45e00ceac1150a83df0e32d015284f4c8f6 npm ERR! errno -24 npm ERR! EMFILE: too many open files, open '/root/.npm/_cacac...
When I run buildah bud, I'm getting the following error.
npm ERR! code EMFILE
npm ERR! syscall open
npm ERR! path /root/.npm/_cacache/index-v5/cd/a5/aca06eccd914d83e3be09412f45e00ceac1150a83df0e32d015284f4c8f6
npm ERR! errno -24
npm ERR! EMFILE: too many open files, open '/root/.npm/_cacache/index-v5/cd/a5/aca06eccd914d83e3be09412f45e00ceac1150a83df0e32d015284f4c8f6'
How can I resolve this problem?
Evan Carroll (34663 rep)
Feb 22, 2023, 08:19 PM • Last activity: Oct 18, 2023, 04:09 PM
3 votes
0 answers
1104 views
Why does buildah fail mounting overlays?
I am running buildah(quay.io/containers/buildah) in a gitlab CI/CD pipeline(kubernetes pod), but it fails building images. `buildah bud .` returns: ``` mount /var/lib/containers/storage/overlay:/var/lib/containers/storage/overlay, flags: 0x1000: permission denied time="2023-05-03T13:02:06Z" level=wa...
I am running buildah(quay.io/containers/buildah) in a gitlab CI/CD pipeline(kubernetes pod), but it fails building images. buildah bud . returns:
mount /var/lib/containers/storage/overlay:/var/lib/containers/storage/overlay, flags: 0x1000: permission denied
time="2023-05-03T13:02:06Z" level=warning msg="failed to shutdown storage: \"mount /var/lib/containers/storage/overlay:/var/lib/containers/storage/overlay, flags: 0x1000: permission denied\""
failed with exit code 125
Buildah inside of the container is running as root, and I made sure that the overlay module is loaded lsmod | grep overlay. I also read the [troubleshooting guide](https://github.com/containers/buildah/blob/main/troubleshooting.md) , but it only mentions issues in rootless mode. What could cause issues while mounting overlay filesystems? And which component could be causing the problem(kubernetes, buildah,gitlab-ci-cd,...)? Thanks in advance :)
iaquobe (411 rep)
May 4, 2023, 03:10 PM
5 votes
2 answers
2772 views
How do you prune with buildah?
When I run `buildah containers`, I see this CONTAINER ID BUILDER IMAGE ID IMAGE NAME CONTAINER NAME f5a361407499 * a24bb4013296 docker.io/library/alpine:latest alpine-working-container eb03f2eb1fb6 * a24bb4013296 docker.io/library/alpine:latest alpine-working-container-1 bb051587d0f0 * a24bb4013296...
When I run buildah containers, I see this CONTAINER ID BUILDER IMAGE ID IMAGE NAME CONTAINER NAME f5a361407499 * a24bb4013296 docker.io/library/alpine:latest alpine-working-container eb03f2eb1fb6 * a24bb4013296 docker.io/library/alpine:latest alpine-working-container-1 bb051587d0f0 * a24bb4013296 docker.io/library/alpine:latest alpine-working-container-2 876a6633ccff * a24bb4013296 docker.io/library/alpine:latest alpine-working-container-3 How can I prune this list? I'm not using any of these any more. I don't see a buildah prune or buildah container prune? When I run podman container ls I don't see any containers listed.
Evan Carroll (34663 rep)
Jul 25, 2020, 07:07 PM • Last activity: Mar 12, 2023, 09:04 AM
-1 votes
1 answers
90 views
Is there an idiom for "if this image doesn't exist, build it"
I am using `buildah` to build [container images](https://opencontainers.org/). I want to build an image, but only if one doesn't exist. Is there an easy way to do this?
I am using buildah to build [container images](https://opencontainers.org/) . I want to build an image, but only if one doesn't exist. Is there an easy way to do this?
Evan Carroll (34663 rep)
Mar 6, 2023, 02:10 AM • Last activity: Mar 6, 2023, 01:52 PM
1 votes
2 answers
437 views
Can I pull an image down from a repo and save it locally as a different name?
I can pull down an image with `podman pull` podman pull alpine:3 This currently pulls the image down as, ```text REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/library/alpine 3 14119a10abf4 5 weeks ago 5.87 MB ``` Is there anyway to save that image for future reference as `localhost/foo`?
I can pull down an image with podman pull podman pull alpine:3 This currently pulls the image down as,
REPOSITORY                TAG             IMAGE ID      CREATED         SIZE
docker.io/library/alpine  3               14119a10abf4  5 weeks ago     5.87 MB
Is there anyway to save that image for future reference as localhost/foo?
Evan Carroll (34663 rep)
Oct 5, 2021, 01:32 AM • Last activity: Apr 19, 2022, 04:46 PM
0 votes
2 answers
115 views
How do you set --author and --message for the image using buildah?
There is both a `buildah commit` and a `podman commit` however the `buildah commit` doesn't support `--author` or `--message` which is provided by `podman`. Is there a way to get this functionality with just `buildah`? Or do I need to take a container online with the image merely to set the author a...
There is both a buildah commit and a podman commit however the buildah commit doesn't support --author or --message which is provided by podman. Is there a way to get this functionality with just buildah? Or do I need to take a container online with the image merely to set the author and message?
Evan Carroll (34663 rep)
Jul 19, 2021, 06:46 PM • Last activity: Jul 20, 2021, 05:47 PM
-1 votes
1 answers
230 views
`buildah unshare`: ERRO exec: "buildah-script.sh": executable file not found in $PATH
The very command `buildah unshare buildah-script.sh` is in `man buildah`, but when I run it I'm getting, ❯ buildah unshare buildah-script.sh ERRO exec: "buildah-script.sh": executable file not found in $PATH ERRO (unable to determine exit status) ERRO exit status 1 This is with, buildah version 1.19...
The very command buildah unshare buildah-script.sh is in man buildah, but when I run it I'm getting, ❯ buildah unshare buildah-script.sh ERRO exec: "buildah-script.sh": executable file not found in $PATH ERRO (unable to determine exit status) ERRO exit status 1 This is with, buildah version 1.19.6 (image-spec 1.0.1-dev, runtime-spec 1.0.2-dev)
Evan Carroll (34663 rep)
Jul 19, 2021, 04:56 PM • Last activity: Jul 19, 2021, 05:05 PM
1 votes
1 answers
1149 views
When I run newapkbuild in a container I get "ERROR: : Do not run abuild as root"
I'm trying to containerize my build work flow. I do not run Alpine on the metal or in a VM but I do launch Alpine Containers. When building a new Alpine package, I'm using `newapkbuild` but because I'm in a container, the container thinks it's root (though it's mapped to non-root, and the whole cont...
I'm trying to containerize my build work flow. I do not run Alpine on the metal or in a VM but I do launch Alpine Containers. When building a new Alpine package, I'm using newapkbuild but because I'm in a container, the container thinks it's root (though it's mapped to non-root, and the whole container is rootless). But when I run newapkbuild, I'm getting / # /usr/bin/newapkbuild mypackage >>> ERROR: : Do not run abuild as root >>> ERROR: : Do not run abuild as root
Evan Carroll (34663 rep)
Feb 19, 2021, 06:37 AM • Last activity: Mar 19, 2021, 05:25 PM
0 votes
2 answers
178 views
What is the effect of a symlink in a buildah mount?
If I run a buildah script like this, ctr=$(buildah from alpine:3) mnt=$(buildah mount "$ctr") ln -sf "$PWD/foo" "$mnt/foo" buildah commit $ctr "myimage" Will the directory created link outside the container?
If I run a buildah script like this, ctr=$(buildah from alpine:3) mnt=$(buildah mount "$ctr") ln -sf "$PWD/foo" "$mnt/foo" buildah commit $ctr "myimage" Will the directory created link outside the container?
Evan Carroll (34663 rep)
Feb 19, 2021, 01:05 AM • Last activity: Feb 19, 2021, 09:14 AM
2 votes
1 answers
1841 views
Podman vs Buildah: buildah from, run, and commit -versus- podman run, exec, and commit?
It seems we have the workflow to launch a container, and run commands inside of it, and commit it. buildah-from - Creates a new working container, either from scratch or using a specified image as a starting point. buildah-run - Run a command inside of the container. buildah-commit - Create an image...
It seems we have the workflow to launch a container, and run commands inside of it, and commit it. buildah-from - Creates a new working container, either from scratch or using a specified image as a starting point. buildah-run - Run a command inside of the container. buildah-commit - Create an image from a working container. But we can do the same thing with podman? podman-run - Run a command in a new container podman-exec - Execute a command in a running container podman-commit - Create new image based on the changed container What's the difference between these two sequences of commands? When should we prefer one over the other?
Evan Carroll (34663 rep)
Nov 12, 2020, 06:46 PM • Last activity: Jan 5, 2021, 08:02 AM
2 votes
2 answers
2691 views
podman run with --init gives me: Error: container-init binary not found on the host: stat /usr/libexec/podman/catatonit: no such file or directory
When I run `podman run --init`, I get $> podman run --init -ti cp /sbin/init Error: container-init binary not found on the host: stat /usr/libexec/podman/catatonit: no such file or directory But I can easily verify that there is an init there, $> podman run cp ls -- /sbin | grep init init telinit Wh...
When I run podman run --init, I get $> podman run --init -ti cp /sbin/init Error: container-init binary not found on the host: stat /usr/libexec/podman/catatonit: no such file or directory But I can easily verify that there is an init there, $> podman run cp ls -- /sbin | grep init init telinit What is catatonit? Why am I getting this error and how can I resolve it?
Evan Carroll (34663 rep)
Nov 12, 2020, 10:35 AM • Last activity: Dec 30, 2020, 02:52 AM
2 votes
1 answers
1590 views
Run multiple commands inside a buildah container separated by the boolean AND (&&) operator from the command line
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 --...
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.
EarthIsHome (295 rep)
Dec 26, 2020, 01:47 AM • Last activity: Dec 28, 2020, 12:28 PM
0 votes
2 answers
282 views
Can docker pull an image visable in podman and buildah?
If I run `buildah images`, I see an image that is fully visable and functional with `podman` and `buildah` toolchain, $ buildah images REPOSITORY TAG IMAGE ID CREATED SIZE localhost/foobar-centos-7 92 688ca4049c1e 24 hours ago 4.13 GB localhost/centos-base 7 fec48054ea4d 24 hours ago 325 MB However,...
If I run buildah images, I see an image that is fully visable and functional with podman and buildah toolchain, $ buildah images REPOSITORY TAG IMAGE ID CREATED SIZE localhost/foobar-centos-7 92 688ca4049c1e 24 hours ago 4.13 GB localhost/centos-base 7 fec48054ea4d 24 hours ago 325 MB However, minikube doesn't yet work with Podman v2, and the driver is experimental with v1. I need these images to available to docker, which underscores minikube and is the only supported driver. Note, I don't want to have to push to an external registry or set up quay.
Evan Carroll (34663 rep)
Nov 23, 2020, 03:30 AM • Last activity: Nov 24, 2020, 04:27 PM
0 votes
2 answers
372 views
Why does buildah run support `--hostname`, but not podman exec?
Both `buildah run`, and `podman exec` run programs in active containers, buildah-run - Run a command inside of the container. podman-exec - Execute a command in a running container However, only `buildah run` supports a `--hostname` options? Why aren't these commands in parity? Why do they have diff...
Both buildah run, and podman exec run programs in active containers, buildah-run - Run a command inside of the container. podman-exec - Execute a command in a running container However, only buildah run supports a --hostname options? Why aren't these commands in parity? Why do they have different capabilities? Put another way, [buildah currently has a broken --hostname option](https://unix.stackexchange.com/q/619205/3285) , but it's not clear to my why it would ever work. With podman the option is set when you *launch* the container and with buildah that's done with buildah from so shouldn't buildah from have the --hostname argument?
Evan Carroll (34663 rep)
Nov 13, 2020, 04:00 AM • Last activity: Nov 23, 2020, 03:38 PM
2 votes
1 answers
3967 views
What are "container-tools" and what does disabling them achieve?
The [buildah docs for installation](https://github.com/containers/buildah/blob/master/install.md) mention, sudo dnf -y module disable container-tools Interestingly, the advice for RHEL 8 BETA is to enable them sudo yum module enable -y container-tools:1.0 What does this line do? And by extension wha...
The [buildah docs for installation](https://github.com/containers/buildah/blob/master/install.md) mention, sudo dnf -y module disable container-tools Interestingly, the advice for RHEL 8 BETA is to enable them sudo yum module enable -y container-tools:1.0 What does this line do? And by extension what is container-tools and why do I want to disable them?
Evan Carroll (34663 rep)
Nov 22, 2020, 05:58 AM • Last activity: Nov 23, 2020, 06:22 AM
1 votes
1 answers
955 views
buildah: unknown shorthand flag: 'i' in -i
If I am to launch a container with podman I can use the `-ti` flags to connect my terminal to the container, $ podman run -ti centos:7 /bin/sh sh-4.2# exit But the same option I build with buildah it returns $ buildah run -ti $(buildah from centos:7) /bin/sh unknown shorthand flag: 'i' in -i What is...
If I am to launch a container with podman I can use the -ti flags to connect my terminal to the container, $ podman run -ti centos:7 /bin/sh sh-4.2# exit But the same option I build with buildah it returns $ buildah run -ti $(buildah from centos:7) /bin/sh unknown shorthand flag: 'i' in -i What is the right method to invoke buildah?
Evan Carroll (34663 rep)
Nov 18, 2020, 07:50 PM • Last activity: Nov 18, 2020, 09:22 PM
2 votes
1 answers
381 views
Why does `exec init` work in podman but not buildah with the same options?
How are these two commands different? Both of them launch a shell as pid 1 and make the same mounts and volumes, buildah run --tty --mount type=tmpfs,destination=/run -v /sys/fs/cgroup:/sys/fs/cgroup:ro \ $(buildah from centos:7) /bin/sh -c 'exec /sbin/init' podman run -ti --mount type=tmpfs,destina...
How are these two commands different? Both of them launch a shell as pid 1 and make the same mounts and volumes, buildah run --tty --mount type=tmpfs,destination=/run -v /sys/fs/cgroup:/sys/fs/cgroup:ro \ $(buildah from centos:7) /bin/sh -c 'exec /sbin/init' podman run -ti --mount type=tmpfs,destination=/run -v /sys/fs/cgroup:/sys/fs/cgroup:ro \ centos:7 /bin/sh -c 'exec /sbin/init' Only the podman one works though. What am I misunderstanding here?
Evan Carroll (34663 rep)
Nov 18, 2020, 07:55 PM • Last activity: Nov 18, 2020, 08:40 PM
3 votes
1 answers
278 views
How does --hostname work with `buildah run`?
Give the example here which has an attempt at setting the hostname to `foo.bar.baz` for the duration of the build, #!/bin/bash ctr=$(buildah from alpine:3) buildah run --hostname 'foo.bar.baz' $ctr /bin/sh <<-'EOF' echo "/usr/bin/hostname returns [$(hostname)]"; EOF I get the following output, /usr/...
Give the example here which has an attempt at setting the hostname to foo.bar.baz for the duration of the build, #!/bin/bash ctr=$(buildah from alpine:3) buildah run --hostname 'foo.bar.baz' $ctr /bin/sh <<-'EOF' echo "/usr/bin/hostname returns [$(hostname)]"; EOF I get the following output, /usr/bin/hostname returns [myHostname] I was expecting hostname to return foo.bar.baz. I'm using Debian Testing's buildah package 1.15.2-1. ❯ buildah version Version: 1.15.2 Go Version: go1.14.7 Image Spec: 1.0.1 Runtime Spec: 1.0.2-dev CNI Spec: 0.4.0 libcni Version: image Version: 5.5.2 Git Commit: Built: Wed Dec 31 18:00:00 1969 OS/Arch: linux/amd64 But I've also tested it on 1.17, ❯ buildah version Version: 1.17.0 Go Version: go1.15.2 Image Spec: 1.0.1-dev Runtime Spec: 1.0.2-dev CNI Spec: 0.4.0 libcni Version: image Version: 5.7.0 Git Commit: Built: Wed Dec 31 18:00:00 1969 OS/Arch: linux/amd64
Evan Carroll (34663 rep)
Nov 12, 2020, 08:38 AM • Last activity: Nov 17, 2020, 12:25 AM
0 votes
2 answers
348 views
How can I test that a buildah script is run under buildah-unshare?
If I have a script that uses `buildah mount`. I use the same way the docs specify, mnt=$(buildah mount $ctr) If I invoke my script `sh ./build.sh`, I get > cannot mount using driver overlay in rootless mode. You need to run it in a `buildah unshare` session The problem is that the script doesn't ter...
If I have a script that uses buildah mount. I use the same way the docs specify, mnt=$(buildah mount $ctr) If I invoke my script sh ./build.sh, I get > cannot mount using driver overlay in rootless mode. You need to run it in a buildah unshare session The problem is that the script doesn't terminate in the event of failure here. I can check it out by testing for if [-z $mnt]; then echo "Run with buildah-unshare; exit; fi, but this is not ideal because then I still have the prior buildah from that I'm doing for nothing. If you're trying to support rootless buildah, is there a way to ensure that you're running the buildah under buildah unshare?
Evan Carroll (34663 rep)
Nov 14, 2020, 10:57 PM • Last activity: Nov 16, 2020, 02:34 PM
1 votes
1 answers
359 views
Container runs systemd, what's the easiest way to execute a script that uses systemd?
I have a container that runs systemd, the setup instructions followed can be found at * [*Dockerfile for systemd base image*](https://hub.docker.com/_/centos) Now I have a script `install.sh` which I need to run in the build phase over the base image created above. The problem is that the `install.s...
I have a container that runs systemd, the setup instructions followed can be found at * [*Dockerfile for systemd base image*](https://hub.docker.com/_/centos) Now I have a script install.sh which I need to run in the build phase over the base image created above. The problem is that the install.sh is systemd aware. So what is the easiest way to have systemd's init run that install.sh, what I want is something like buildah run $ctr -- sh /tmp/install.sh But this will **not** run install.sh under systemd, as I require.
Evan Carroll (34663 rep)
Nov 13, 2020, 08:18 PM • Last activity: Nov 14, 2020, 08:20 PM
Showing page 1 of 20 total questions