commit
d481cd356d
3 changed files with 51 additions and 0 deletions
@ -0,0 +1,9 @@ |
|||
FROM quay.io/fedora/fedora:42 |
|||
|
|||
RUN dnf install -y qemu-user-static \ |
|||
&& dnf clean all |
|||
|
|||
ADD container-entrypoint / |
|||
|
|||
ENTRYPOINT ["/container-entrypoint"] |
|||
CMD [] |
|||
@ -0,0 +1,22 @@ |
|||
# qemu-user-static container image |
|||
|
|||
## Build |
|||
|
|||
```sh |
|||
git clone https://github.com/nmasse-itix/qemu-user-static.git |
|||
cd qemu-user-static |
|||
sudo podman build -t localhost/qemu-user-static:latest . |
|||
``` |
|||
|
|||
## Run |
|||
|
|||
```sh |
|||
sudo podman run -it --privileged --security-opt label=filetype:container_file_t --security-opt label=level:s0 --security-opt label=type:spc_t localhost/qemu-user-static:latest |
|||
``` |
|||
|
|||
## Test |
|||
|
|||
```sh |
|||
sudo podman run -it --rm --platform linux/arm64/v8 docker.io/library/alpine:latest |
|||
``` |
|||
|
|||
@ -0,0 +1,20 @@ |
|||
#!/bin/sh |
|||
|
|||
set -Eeuo pipefail |
|||
|
|||
if [ ! -d /proc/sys/fs/binfmt_misc ]; then |
|||
echo "No binfmt support in the kernel." |
|||
echo " Try: '/sbin/modprobe binfmt_misc' from the host" |
|||
exit 1 |
|||
fi |
|||
|
|||
if [ ! -f /proc/sys/fs/binfmt_misc/register ]; then |
|||
echo "Mounting /proc/sys/fs/binfmt_misc..." |
|||
mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc |
|||
fi |
|||
|
|||
echo "Cleaning up..." |
|||
find /proc/sys/fs/binfmt_misc -type f -name 'qemu-*' -exec sh -c 'echo -1 > {}' \; |
|||
|
|||
echo "Registering..." |
|||
exec /usr/lib/systemd/systemd-binfmt |
|||
Loading…
Reference in new issue