-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathrun-podman-compose.sh
More file actions
executable file
·28 lines (21 loc) · 980 Bytes
/
run-podman-compose.sh
File metadata and controls
executable file
·28 lines (21 loc) · 980 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env bash
set -euo pipefail
# Enable verbose mode for this script if VERBOSE=1
VERBOSE="${VERBOSE:-0}"
if [[ "$VERBOSE" == "1" ]]; then
set -x
fi
# Podman log level (debug if VERBOSE=1, otherwise info)
PODMAN_LOG_LEVEL="${PODMAN_LOG_LEVEL:-$([[ "$VERBOSE" == "1" ]] && echo debug || echo info)}"
echo ">> Using PODMAN_LOG_LEVEL=$PODMAN_LOG_LEVEL"
# 1) In the Podman VM, the Docker-compatible socket is /run/docker.sock
DOCKER_SOCKET_PATH="/run/docker.sock"
echo ">> Using DOCKER_SOCKET_PATH=$DOCKER_SOCKET_PATH"
# (Optional) Safety: make sure the socket is readable/writable
podman machine ssh -- "sudo chmod 666 /run/user/*/podman/podman.sock /run/docker.sock 2>/dev/null || true"
# 2) Run podman compose with the right environment variables
export DOCKER_SOCKET_PATH
export DOCKER_HOST="unix:///var/run/docker.sock"
export PODMAN_LOG_LEVEL
echo ">> Running: podman --log-level=$PODMAN_LOG_LEVEL compose $*"
podman --log-level="$PODMAN_LOG_LEVEL" compose "$@"