Skip to content

Commit 6ace72a

Browse files
liavweissLiav Weiss
andauthored
fix podman supporting in docker-compose targets and quickstart.sh (#772)
Signed-off-by: Liav Weiss <[email protected]> Co-authored-by: Liav Weiss <[email protected]>
1 parent 32c3399 commit 6ace72a

File tree

2 files changed

+57
-38
lines changed

2 files changed

+57
-38
lines changed

scripts/quickstart.sh

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4+
# Container runtime (docker or podman) - can be set via environment variable
5+
CONTAINER_RUNTIME="${CONTAINER_RUNTIME:-docker}"
6+
47
# Colors for output
58
RED='\033[0;31m'
69
GREEN='\033[0;32m'
@@ -111,14 +114,20 @@ check_prerequisites() {
111114

112115
local missing_deps=()
113116

114-
# Check Docker
115-
if ! command -v docker &> /dev/null; then
116-
missing_deps+=("docker")
117+
# Check container runtime (docker or podman)
118+
if ! command -v "$CONTAINER_RUNTIME" &> /dev/null; then
119+
missing_deps+=("$CONTAINER_RUNTIME")
117120
fi
118121

119-
# Check Docker Compose
120-
if ! command -v docker compose &> /dev/null && ! command -v docker-compose &> /dev/null; then
121-
missing_deps+=("docker-compose")
122+
# Check compose command
123+
if [ "$CONTAINER_RUNTIME" = "podman" ]; then
124+
if ! command -v podman compose &> /dev/null && ! command -v podman-compose &> /dev/null; then
125+
missing_deps+=("podman-compose or podman compose plugin")
126+
fi
127+
else
128+
if ! command -v docker compose &> /dev/null && ! command -v docker-compose &> /dev/null; then
129+
missing_deps+=("docker-compose")
130+
fi
122131
fi
123132

124133
# Check Make
@@ -195,7 +204,7 @@ download_models() {
195204

196205
# Function to start services
197206
start_services() {
198-
info_msg "🐳 Starting Docker services..."
207+
info_msg "🐳 Starting container services (using $CONTAINER_RUNTIME)..."
199208
echo
200209

201210
# Start docker-compose services (runs in detached mode via Makefile)
@@ -204,7 +213,7 @@ start_services() {
204213
# - Dashboard build from Dockerfile (Go compilation can take 5-10 minutes)
205214
# - Network/system variations
206215
# Save output to log file for debugging
207-
if timeout 600 make docker-compose-up 2>&1 | tee /tmp/docker-compose-output.log; then
216+
if timeout 600 make docker-compose-up CONTAINER_RUNTIME="$CONTAINER_RUNTIME" 2>&1 | tee /tmp/docker-compose-output.log; then
208217
success_msg "✅ Docker compose command completed!"
209218
echo " Output saved to: /tmp/docker-compose-output.log"
210219
else
@@ -240,17 +249,18 @@ wait_for_services() {
240249

241250
# Check each critical service
242251
for service in "${critical_services[@]}"; do
243-
if ! docker ps --filter "name=$service" --filter "health=healthy" --format "{{.Names}}" | grep -q "$service" 2>/dev/null; then
252+
if ! "$CONTAINER_RUNTIME" ps --filter "name=$service" --filter "health=healthy" --format "{{.Names}}" | grep -q "$service" 2>/dev/null; then
244253
all_healthy=false
245254
unhealthy_services="$unhealthy_services $service"
246255
fi
247256
done
248257

249258
# Check for any exited/failed containers
250-
local failed_containers=$(docker ps -a --filter "status=exited" --format "{{.Names}}" 2>/dev/null)
259+
local failed_containers
260+
failed_containers=$("$CONTAINER_RUNTIME" ps -a --filter "status=exited" --format "{{.Names}}" 2>/dev/null)
251261
if [ -n "$failed_containers" ]; then
252262
error_msg "❌ Some containers failed to start: $failed_containers"
253-
info_msg "📋 Check logs with: docker compose logs $failed_containers"
263+
info_msg "📋 Check logs with: $CONTAINER_RUNTIME compose logs $failed_containers"
254264
return 1
255265
fi
256266

@@ -259,7 +269,7 @@ wait_for_services() {
259269
echo
260270
# Show status of all containers
261271
section_header "📊 Container Status:"
262-
docker ps --format "table {{.Names}}\t{{.Status}}" | grep -E "NAMES|semantic-router|envoy|dashboard|prometheus|grafana|jaeger|openwebui|pipelines|llm-katan"
272+
"$CONTAINER_RUNTIME" ps --format "table {{.Names}}\t{{.Status}}" | grep -E "NAMES|semantic-router|envoy|dashboard|prometheus|grafana|jaeger|openwebui|pipelines|llm-katan"
263273
echo
264274
return 0
265275
fi
@@ -274,8 +284,8 @@ wait_for_services() {
274284
done
275285

276286
info_msg "⚠️ Timeout: Services are starting but not all are healthy yet."
277-
print_color "$WHITE" "📋 Check status with: docker ps"
278-
print_color "$WHITE" "📋 View logs with: docker compose logs -f"
287+
print_color "$WHITE" "📋 Check status with: $CONTAINER_RUNTIME ps"
288+
print_color "$WHITE" "📋 View logs with: $CONTAINER_RUNTIME compose logs -f"
279289
return 1
280290
}
281291

@@ -295,10 +305,10 @@ show_service_info() {
295305
echo
296306
section_header "🔧 Useful Commands:"
297307
echo
298-
print_color "$WHITE" " • Check service status: docker compose ps"
299-
print_color "$WHITE" " • View logs: docker compose logs -f"
300-
print_color "$WHITE" " • Stop services: docker compose down"
301-
print_color "$WHITE" " • Restart services: docker compose restart"
308+
print_color "$WHITE" " • Check service status: $CONTAINER_RUNTIME compose ps"
309+
print_color "$WHITE" " • View logs: $CONTAINER_RUNTIME compose logs -f"
310+
print_color "$WHITE" " • Stop services: $CONTAINER_RUNTIME compose down"
311+
print_color "$WHITE" " • Restart services: $CONTAINER_RUNTIME compose restart"
302312
echo
303313
}
304314

@@ -355,7 +365,7 @@ main() {
355365
# Wait for services to be healthy
356366
if ! wait_for_services; then
357367
error_msg "❌ Service health check failed or timed out!"
358-
info_msg "📋 You can check logs with: docker compose logs"
368+
info_msg "📋 You can check logs with: $CONTAINER_RUNTIME compose logs"
359369
info_msg "📋 Or continue manually if services are starting"
360370
exit 1
361371
fi

tools/make/docker.mk

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -108,31 +108,39 @@ docker-push-llm-katan:
108108
REBUILD ?=
109109
BUILD_FLAG=$(if $(REBUILD),--build,)
110110

111+
# Compose command: use podman compose (plugin) for podman, docker compose (plugin) for docker
112+
# Both use COMPOSE_FILE and COMPOSE_PROJECT_NAME environment variables automatically
113+
ifeq ($(CONTAINER_RUNTIME),podman)
114+
COMPOSE_CMD = podman compose
115+
else
116+
COMPOSE_CMD = $(CONTAINER_RUNTIME) compose
117+
endif
118+
111119
# Docker compose shortcuts (no rebuild by default)
112120
docker-compose-up: ## Start services (default includes llm-katan; REBUILD=1 to rebuild)
113121
docker-compose-up:
114122
@$(LOG_TARGET)
115-
@echo "Starting services with docker-compose (default includes llm-katan) (REBUILD=$(REBUILD))..."
116-
@docker compose --profile llm-katan up -d $(BUILD_FLAG)
123+
@echo "Starting services with $(COMPOSE_CMD) (default includes llm-katan) (REBUILD=$(REBUILD))..."
124+
@$(COMPOSE_CMD) --profile llm-katan up -d $(BUILD_FLAG)
117125

118126
docker-compose-up-testing: ## Start with testing profile (REBUILD=1 optional)
119127
docker-compose-up-testing:
120128
@$(LOG_TARGET)
121-
@echo "Starting services with testing profile (REBUILD=$(REBUILD))..."
122-
@docker compose --profile testing up -d $(BUILD_FLAG)
129+
@echo "Starting services with $(COMPOSE_CMD) (testing profile) (REBUILD=$(REBUILD))..."
130+
@$(COMPOSE_CMD) --profile testing up -d $(BUILD_FLAG)
123131

124132
docker-compose-up-llm-katan: ## Start with llm-katan profile (REBUILD=1 optional)
125133
docker-compose-up-llm-katan:
126134
@$(LOG_TARGET)
127-
@echo "Starting services with llm-katan profile (REBUILD=$(REBUILD))..."
128-
@docker compose --profile llm-katan up -d $(BUILD_FLAG)
135+
@echo "Starting services with $(COMPOSE_CMD) (llm-katan profile) (REBUILD=$(REBUILD))..."
136+
@$(COMPOSE_CMD) --profile llm-katan up -d $(BUILD_FLAG)
129137

130138
# Start core services only (closer to production; excludes llm-katan)
131139
docker-compose-up-core: ## Start core services only (no llm-katan)
132140
docker-compose-up-core:
133141
@$(LOG_TARGET)
134-
@echo "Starting core services (no llm-katan) (REBUILD=$(REBUILD))..."
135-
@docker compose up -d $(BUILD_FLAG)
142+
@echo "Starting core services with $(COMPOSE_CMD) (no llm-katan) (REBUILD=$(REBUILD))..."
143+
@$(COMPOSE_CMD) up -d $(BUILD_FLAG)
136144

137145
# Explicit rebuild targets for convenience
138146
docker-compose-rebuild: ## Force rebuild then start
@@ -150,31 +158,32 @@ docker-compose-rebuild-llm-katan: docker-compose-up-llm-katan
150158
docker-compose-down:
151159
docker-compose-down: ## Stop services (default includes llm-katan)
152160
@$(LOG_TARGET)
153-
@echo "Stopping docker-compose services (default includes llm-katan)..."
154-
@docker compose --profile llm-katan down
161+
@echo "Stopping services with $(COMPOSE_CMD) (default includes llm-katan)..."
162+
@$(COMPOSE_CMD) --profile llm-katan down
155163

156164
docker-compose-down-core: ## Stop core services only (no llm-katan)
157165
docker-compose-down-core:
158166
@$(LOG_TARGET)
159-
@echo "Stopping core services only (no llm-katan)..."
160-
@docker compose down
167+
@echo "Stopping core services with $(COMPOSE_CMD) (no llm-katan)..."
168+
@$(COMPOSE_CMD) down
161169

162170
docker-compose-down-testing: ## Stop services with testing profile
163171
docker-compose-down-testing:
164172
@$(LOG_TARGET)
165-
@echo "Stopping services with testing profile..."
166-
@docker compose --profile testing down
173+
@echo "Stopping services with $(COMPOSE_CMD) (testing profile)..."
174+
@$(COMPOSE_CMD) --profile testing down
167175

168176
docker-compose-down-llm-katan: ## Stop services with llm-katan profile
169177
docker-compose-down-llm-katan:
170178
@$(LOG_TARGET)
171-
@echo "Stopping services with llm-katan profile..."
172-
@docker compose --profile llm-katan down
179+
@echo "Stopping services with $(COMPOSE_CMD) (llm-katan profile)..."
180+
@$(COMPOSE_CMD) --profile llm-katan down
173181

174182
# Help target for Docker commands
175183
docker-help:
176184
docker-help: ## Show help for Docker-related make targets and environment variables
177185
@echo "Environment Variables:"
178-
@echo " DOCKER_REGISTRY - Docker registry (default: ghcr.io/vllm-project/semantic-router)"
179-
@echo " DOCKER_TAG - Docker tag (default: latest)"
180-
@echo " SERVED_NAME - Served model name for custom runs"
186+
@echo " CONTAINER_RUNTIME - Container runtime (default: docker, can be set to podman)"
187+
@echo " DOCKER_REGISTRY - Docker registry (default: ghcr.io/vllm-project/semantic-router)"
188+
@echo " DOCKER_TAG - Docker tag (default: latest)"
189+
@echo " SERVED_NAME - Served model name for custom runs"

0 commit comments

Comments
 (0)