22
33set -e
44
5+ # Auto-detect Docker or Podman
6+ source " $( dirname " $0 " ) /detect-runtime.sh"
7+
58configure_registry_mirror () {
69 local cache_name=$1
710 local remote_url=$2
@@ -11,10 +14,10 @@ configure_registry_mirror() {
1114 echo " Configuring cache ${cache_name} on all nodes..."
1215 for node in $( kind get nodes --name cfk8s) ; do
1316 # Create containerd registry config directories
14- docker exec " $node " mkdir -p /etc/containerd/certs.d/${registry_uri}
17+ ${CONTAINER_RUNTIME} exec " $node " mkdir -p /etc/containerd/certs.d/${registry_uri}
1518
1619 # Configure registry to use cache as mirror (expand variables!)
17- cat << EOF | docker exec -i "$node " sh -c "cat > /etc/containerd/certs.d/${registry_uri} /hosts.toml"
20+ cat << EOF | ${CONTAINER_RUNTIME} exec -i "$node " sh -c "cat > /etc/containerd/certs.d/${registry_uri} /hosts.toml"
1821server = "${remote_url} "
1922
2023[host."http://${cache_name} :5000"]
2427 done
2528}
2629
27- evaluate_docker_progress_option () {
28- # Detect container runtime behind docker (Docker vs Podman)
29- if echo $( docker version ) | grep -qi ' Podman ' ; then
30+ evaluate_progress_option () {
31+ # Podman compose does not support --progress
32+ if [ " ${IS_PODMAN} " = " true " ] ; then
3033 echo " "
3134 else
3235 echo " --progress plain"
3336 fi
3437}
3538
3639setup_registry_caches () {
37- echo " Starting registry pull-through caches with docker-compose ..."
38- docker compose -p cache -f " ${script_full_path} /docker-compose-registries.yaml" $( evaluate_docker_progress_option ) up -d
40+ echo " Starting registry pull-through caches with ${COMPOSE_CMD} ..."
41+ ${COMPOSE_CMD} -p cache -f " ${script_full_path} /docker-compose-registries.yaml" $( evaluate_progress_option ) up -d
3942
4043 configure_registry_mirror " docker-io" " https://registry-1.docker.io" " docker.io"
4144 configure_registry_mirror " ghcr-io" " https://ghcr.io" " ghcr.io"
4245 configure_registry_mirror " quay-io" " https://quay.io" " quay.io"
4346}
4447
4548setup_nfs () {
46- echo " Starting NFS server with docker-compose ..."
47- docker compose -p nfs -f " ${script_full_path} /docker-compose-nfs.yaml" $( evaluate_docker_progress_option ) up -d
49+ echo " Starting NFS server with ${COMPOSE_CMD} ..."
50+ ${COMPOSE_CMD} -p nfs -f " ${script_full_path} /docker-compose-nfs.yaml" $( evaluate_progress_option ) up -d
4851}
4952
5053script_full_path=$( dirname " $0 " )
5154
55+ # When running under Podman, ensure the Podman VM is ready (NFS modules, inotify, …)
56+ if [ " ${IS_PODMAN} " = " true" ]; then
57+ echo " Podman detected – ensuring Podman VM is configured..."
58+ " ${script_full_path} /setup-podman-vm.sh"
59+ fi
60+
5261if kind get clusters | grep -q " cfk8s" ; then
5362 echo " Kind cluster 'cfk8s' already exists."
5463 exit 0
0 commit comments