mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-02 22:02:13 +08:00
fix(scripts): handle docker-init failures gracefully for private registry (#1191)
* fix(scripts): handle docker-init failures gracefully for private registry The make docker-init command was failing on Linux environments when users could not access the private Volces container registry. This commonly occurs in corporate intranet environments with proxies or for users without registry credentials. Changes: - Detect sandbox mode from config.yaml before attempting image pull - Skip image pull entirely for local sandbox mode (default) - Gracefully handle pull failures with informative messages - Update setup-sandbox Makefile target with same error handling Fixes #1168 * Apply suggestions from code review Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: BillionClaw <billionclaw@users.noreply.github.com> Co-authored-by: Willem Jiang <willem.jiang@gmail.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
6
Makefile
6
Makefile
@@ -75,9 +75,13 @@ setup-sandbox:
|
||||
fi; \
|
||||
if command -v docker >/dev/null 2>&1; then \
|
||||
echo "Pulling image using Docker..."; \
|
||||
docker pull "$$IMAGE"; \
|
||||
if docker pull "$$IMAGE"; then \
|
||||
echo ""; \
|
||||
echo "✓ Sandbox image pulled successfully"; \
|
||||
else \
|
||||
echo ""; \
|
||||
echo "⚠ Failed to pull sandbox image (this is OK for local sandbox mode)"; \
|
||||
fi; \
|
||||
else \
|
||||
echo "✗ Neither Docker nor Apple Container is available"; \
|
||||
echo " Please install Docker: https://docs.docker.com/get-docker/"; \
|
||||
|
||||
@@ -70,6 +70,20 @@ cleanup() {
|
||||
# Set up trap for Ctrl+C
|
||||
trap cleanup INT TERM
|
||||
|
||||
docker_available() {
|
||||
# Check that the docker CLI exists
|
||||
if ! command -v docker >/dev/null 2>&1; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Check that the Docker daemon is reachable
|
||||
if ! docker info >/dev/null 2>&1; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# Initialize: pre-pull the sandbox image so first Pod startup is fast
|
||||
init() {
|
||||
echo "=========================================="
|
||||
@@ -79,9 +93,50 @@ init() {
|
||||
|
||||
SANDBOX_IMAGE="enterprise-public-cn-beijing.cr.volces.com/vefaas-public/all-in-one-sandbox:latest"
|
||||
|
||||
# Detect sandbox mode from config.yaml
|
||||
local sandbox_mode
|
||||
sandbox_mode="$(detect_sandbox_mode)"
|
||||
|
||||
# Skip image pull for local sandbox mode (no container image needed)
|
||||
if [ "$sandbox_mode" = "local" ]; then
|
||||
echo -e "${GREEN}Detected local sandbox mode — no Docker image required.${NC}"
|
||||
echo ""
|
||||
|
||||
if docker_available; then
|
||||
echo -e "${GREEN}✓ Docker environment is ready.${NC}"
|
||||
echo ""
|
||||
echo -e "${YELLOW}Next step: make docker-start${NC}"
|
||||
else
|
||||
echo -e "${YELLOW}Docker does not appear to be installed, or the Docker daemon is not reachable.${NC}"
|
||||
echo "Local sandbox mode itself does not require Docker, but Docker-based workflows (e.g., docker-start) will fail until Docker is available."
|
||||
echo ""
|
||||
echo -e "${YELLOW}Install and start Docker, then run: make docker-init && make docker-start${NC}"
|
||||
fi
|
||||
|
||||
return 0
|
||||
fi
|
||||
|
||||
if ! docker images --format '{{.Repository}}:{{.Tag}}' | grep -q "^${SANDBOX_IMAGE}$"; then
|
||||
echo -e "${BLUE}Pulling sandbox image: $SANDBOX_IMAGE ...${NC}"
|
||||
docker pull "$SANDBOX_IMAGE"
|
||||
echo ""
|
||||
|
||||
if ! docker pull "$SANDBOX_IMAGE" 2>&1; then
|
||||
echo ""
|
||||
echo -e "${YELLOW}⚠ Failed to pull sandbox image.${NC}"
|
||||
echo ""
|
||||
echo "This is expected if:"
|
||||
echo " 1. You are using local sandbox mode (default — no image needed)"
|
||||
echo " 2. You are behind a corporate proxy or firewall"
|
||||
echo " 3. The registry requires authentication"
|
||||
echo ""
|
||||
echo -e "${GREEN}The Docker development environment can still be started.${NC}"
|
||||
echo "If you need AIO sandbox (container-based execution):"
|
||||
echo " - Ensure you have network access to the registry"
|
||||
echo " - Or configure a custom sandbox image in config.yaml"
|
||||
echo ""
|
||||
echo -e "${YELLOW}Next step: make docker-start${NC}"
|
||||
return 0
|
||||
fi
|
||||
else
|
||||
echo -e "${GREEN}Sandbox image already exists locally: $SANDBOX_IMAGE${NC}"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user