Skip to content

Commit

Permalink
Merge pull request #73 from rhatdan/main
Browse files Browse the repository at this point in the history
Add demonstration of bootc
  • Loading branch information
rhatdan authored Feb 9, 2024
2 parents a7d4648 + 009e86c commit c0e2da2
Show file tree
Hide file tree
Showing 14 changed files with 76 additions and 0 deletions.
16 changes: 16 additions & 0 deletions bootc/machine/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM quay.io/centos-bootc/fedora-bootc:eln

RUN dnf -y update; \
dnf -y install podman subscription-manager crun crun-wasm crun-krun chrony; \
dnf -y clean all; \
systemctl enable podman.service; \
printf "\nconfdir /etc/chrony.d\n" >> /etc/chrony.conf

ADD usr usr
ADD etc etc

RUN systemctl enable rhsmcertd.service podman.socket

RUN groupadd -g 501 core; useradd -u 501 -g 501 core
USER core
RUN systemctl --user enable podman.socket
1 change: 1 addition & 0 deletions bootc/machine/etc/chrony.d/50-podman-makestep.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
makestep 1 -1
2 changes: 2 additions & 0 deletions bootc/machine/etc/containers/containers.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[engine]
machine_enable=true
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
unqualified-search-registries=["docker.io"]
1 change: 1 addition & 0 deletions bootc/machine/etc/profile.d/docker-host.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export DOCKER_HOST="unix://$(podman info -f "{{.Host.RemoteSocket.Path}}")"
3 changes: 3 additions & 0 deletions bootc/machine/etc/skel/.config/containers/containers.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[containers]
netns="bridge"
pids_limit=0
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Unit]
Description", "A systemd user unit demo
After=network-online.target
Wants=network-online.target podman.socket

[Service]
ExecStart=/usr/bin/sleep infinity

1 change: 1 addition & 0 deletions bootc/machine/etc/subgid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
core:100000:1000000
1 change: 1 addition & 0 deletions bootc/machine/etc/subuid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
core:100000:1000000
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Service]
Delegate=memory pids cpu io
1 change: 1 addition & 0 deletions bootc/machine/usr/lib/sysctl.d/10-inotify-instances.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fs.inotify.max_user_instances=524288
1 change: 1 addition & 0 deletions bootc/machine/usr/lib/tmpfiles.d/podman-docker.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
L+ /run/docker.sock - - - - /run/user/501/podman/podman.sock
37 changes: 37 additions & 0 deletions bootc/podman.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/sh
#!/bin/sh

# Setting up some colors for helping read the demo output.
# Comment out any of the below to turn off that color.
bold=$(tput bold)
cyan=$(tput setaf 6)
reset=$(tput sgr0)

read_color() {
read -p "${bold}$1${reset}"
}

exec_color() {
echo -n "
${bold}$ $1${reset}"
read
bash -c "$1"
}

echo_color() {
echo "${cyan}$1${reset}"
}

IMAGE=quay.io/rhatdan/podman-machine
clear
exec_color "podman login quay.io"
exec_color "cat machine/Containerfile.fcos"
exec_color "podman build -t fcos -f machine/Containerfile.fcos machine/"
exec_color "cat machine/Containerfile"
exec_color "podman build --from fcos -t $IMAGE machine/"
exec_color "podman run --rm -ti $IMAGE sh"
clear
exec_color "podman push $IMAGE"
exec_color "sudo podman run --rm -it --privileged -v .:/output --pull newer quay.io/centos-bootc/bootc-image-builder --type qcow2 $IMAGE:latest"
exec_color "sudo chown -R $UID:$UID qcow2"
exec_color "mv qcow2/disk.qcow2 qcow2/$(basename $IMAGE).qcow2"

0 comments on commit c0e2da2

Please sign in to comment.