services: maven-dev-env: image: maven-java21-dev:3.9-ssh build: context: . dockerfile: Containerfile container_name: maven-devcontainer hostname: maven-devcontainer restart: always ports: - "${APP_PORT:-9090}:9090" - "${SSH_PORT:-2322}:22" # [新增] SSH 端口,宿主机通过 localhost:2222 连接 volumes: - ${PROJECT_DIR:-/workspace}:/workspace # 持久化 Root 用户配置(包含 .ssh, .m2 缓存, .config/zed 等) - /workspace/devcontainer-vols/maven-devcontainer-root:/root