Compare commits
1
Commits
master
...
0bc14cbeff
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0bc14cbeff |
@@ -0,0 +1,16 @@
|
||||
# slim
|
||||
|
||||
Turning containers into bootable VMs
|
||||
|
||||
## Example - Minimal Alpine Busybox
|
||||
|
||||
```sh
|
||||
# Build the container
|
||||
podman build ./example/alpine -t slim-alpine
|
||||
|
||||
# Make the container bootable by extracing initrd and vmlinuz (initial ramdisk and kernel)
|
||||
slim build slim-alpine
|
||||
|
||||
# Boot the image using QEMU, `./example/alpine/init` will drop you into an interactive shell.
|
||||
slim run slim-alpine
|
||||
```
|
||||
@@ -0,0 +1,7 @@
|
||||
FROM alpine:latest
|
||||
RUN mkdir -p /lib/apk/db /run
|
||||
RUN apk add --no-cache --initdb linux-virt busybox util-linux
|
||||
RUN cp /boot/vmlinuz-virt /vmlinuz && echo "Welcome to slim!" > /etc/motd
|
||||
COPY init /init
|
||||
RUN chmod +x /init
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Special folders
|
||||
mkdir -p /dev /proc /sys
|
||||
[ -c /dev/console ] || mknod -m 600 /dev/console c 5 1
|
||||
mount -t proc proc /proc
|
||||
mount -t sysfs sysfs /sys
|
||||
mount -t devtmpfs dev /dev
|
||||
|
||||
# Networking
|
||||
echo slim > /proc/sys/kernel/hostname
|
||||
modprobe virtio_net
|
||||
ip link set lo up 2>/dev/null
|
||||
ip link set eth0 up 2>/dev/null
|
||||
udhcpc -i eth0 -f -q # Get DHCP lease
|
||||
|
||||
echo
|
||||
echo 'Welcome to slim!'
|
||||
echo
|
||||
|
||||
# Run interactive shell
|
||||
/bin/sh </dev/console >/dev/console 2>&1
|
||||
|
||||
poweroff -f
|
||||
while true; do
|
||||
sleep 1
|
||||
poweroff -f
|
||||
done
|
||||
Reference in New Issue
Block a user