Commit e74f42ab authored by Emilien Macchi's avatar Emilien Macchi

Updates

parent e2043d18
......@@ -2,4 +2,10 @@
Repository where I store the demos I do during talks.
They work fine in my environment and I can't guarantee they do in yours.
Fork it, and modify for your needs!
\ No newline at end of file
Fork it, and modify for your needs!
# use (e.g. with containers)
$ git clone https://gitlab.com/emacchi/demos.git
$ cd demos/containers
$ ./podman.sh
#!/bin/bash
source prepare
source cleanup
source $demo_magic_dir/demo-magic.sh
buildah_minimal_image() {
clear
# Buildah from scratch - minimal images
p "Buildah from scratch - building minimal images"
echo ""
p "sudo buildah from scratch"
ctr=$(sudo buildah from scratch)
echo "$ctr"
echo ""
p "sudo buildah mount $ctr"
mnt=$(sudo buildah mount "$ctr")
echo "$mnt"
echo ""
pe "sudo dnf install -y --installroot=$mnt busybox --releasever=29 --disablerepo=* --enablerepo=fedora"
echo ""
pe "sudo dnf clean all --installroot=$mnt"
echo ""
pe "sudo buildah unmount $ctr"
echo ""
pe "sudo buildah commit --rm $ctr minimal-image"
echo ""
pe "sudo podman run --rm minimal-image busybox"
echo ""
p "End of buildah minimal image demo"
}
buildah_minimal_image
......@@ -3,7 +3,8 @@
trap cleanup EXIT
cleanup() {
podman rm -af 2> /dev/null
sudo podman rm -afa 2> /dev/null
sudo podman rm -af 2> /dev/null
rm -rf /var/lib/containers 2> /dev/null
rm -rf ~/.config/containers 2> /dev/null
sudo systemctl stop docker
}
......@@ -3,3 +3,33 @@
source prepare
source cleanup
source $demo_magic_dir/demo-magic.sh
podman_rootless() {
clear
# Rootless podman
p "Podman as rootless (impossible with Docker)"
echo ""
pe "id"
echo ""
pe "buildah pull ubi8-minimal"
echo ""
p "non-privileged images (rootless)"
pe "podman images"
echo ""
p "privileged images (with root)"
pe "sudo podman images"
echo ""
pe "podman run --rm ubi8-minimal id && echo On the host I am not root && id"
echo ""
p "End of podman rootless demo"
clear
}
podman_rootless
#!/bin/bash
clear
echo "Preparing the host for running the demo ..."
# Variables
export DOCKER_ENABLED=${DOCKER_ENABLED:-0}
# Pre-run sanity checks
if [ ! -f /etc/fedora-release ];
if [ ! -f /etc/fedora-release ]; then
echo "Container demos need to run on Fedora!"
exit 1
fi
# Install packages needed for the demos
sudo dnf install -y git buildah podman skopeo
sudo dnf install -y -q git buildah podman skopeo pv audit
# SElinux prepare
sudo cp /usr/share/doc/audit/rules/10-base-config.rules /etc/audit/rules.d/audit-demo.rules
sudo augenrules --load > /dev/null
sudo systemctl restart auditd 2> /dev/null
# Install demo-magic
export = demo_magic_dir=$(mktemp -d)
git clone https://github.com/paxtonhare/demo-magic $demo_magic_dir
export demo_magic_dir=$(mktemp -d)
git clone https://github.com/paxtonhare/demo-magic $demo_magic_dir 2> /dev/null
if [ $DOCKER_ENABLED -eq 1 ]; then
sudo dnf install -y -q docker
sudo systemctl restart docker 2> /dev/null
fi
echo
echo "Host ready!"
clear
#!/bin/bash
export DOCKER_ENABLED="1"
source prepare
source cleanup
source $demo_magic_dir/demo-magic.sh
skopeo_inspect() {
clear
# Skopeo inspect a remote image
p "Inspect a remote image using skopeo"
echo ""
pe "skopeo inspect docker://docker.io/fedora"
echo ""
p "End of skopeo inspect"
clear
}
skopeo_cp_from_docker_to_podman() {
clear
p "Copy images from docker storage to podman storage"
echo ""
pe "sudo podman images"
echo ""
sudo docker pull ubi8-minimal 2> /dev/null
pe "sudo docker images"
echo ""
pe "sudo skopeo copy ubi8-minimal:latest containers-storage:localhost/ubi8-minimal:demo"
echo ""
pe "sudo podman images"
echo ""
p "End of Skopeo cp demo"
clear
}
skopeo_inspect
wait
skopeo_cp_from_docker_to_podman
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment