fix: correct invalid expose syntax in docker-compose#1
Open
Call-me-akan wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
修复描述 (Description)
问题背景:

在 Windows 环境下使用 Docker Desktop 启动项目时,执行
docker compose up -d会触发 Go 语言底层的解析错误:Error response from daemon: strconv.ParseUint: parsing "8000:8000": invalid syntax这导致
sag_api容器无法正常创建和启动。错误原因:
在
docker-compose.yml中,expose字段仅用于声明容器间内部通信的端口,其语法仅接受单个端口数字或列表,而不支持宿主机:容器的映射格式(该格式仅适用于ports字段)。解决方案:
将
api服务下的expose: - "8000:8000"修正为标准的expose: - "8000"。验证情况:
已经在 Windows 11 环境下进行了本地验证,修改后容器可以顺利通过编译并正常启动,不再报语法解析错误。