Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the issue of missing container information caused by the event sequence when docker compose is repeatedly up. #1875

Merged
merged 2 commits into from
Nov 13, 2024

Conversation

linrunqi08
Copy link
Collaborator

问题描述: docker compose环境下,会发现容器信息发现模块会获取的created状态的容器,参见https://alidocs.dingtalk.com/i/nodes/N7dx2rn0JbxOaqnACxvaegn5WMGjLRb3

复现条件:
docker compose up -d命令,启动一个容器之后,修改docker-compose.yaml文件,然后再执行docker compose up -d

问题原因分析:
image

从事件顺序可以看到,新旧容器的交替顺序是这样的:
新容器create(其他名字),旧容器杀、停、删,新容器rename,新容器start
image
事件监听rename的时候,会fetchone,rename的时候,容器还没有start,此时fetchone获取的就是created状态的容器信息。标准输出的插件里面,会根据containerID缓存容器信息,所以及时后面fetchone又更新了容器信息,标准输出也感知不到

修复方案:
fetchone里强校验容器状态

@linrunqi08 linrunqi08 merged commit 9005b10 into main Nov 13, 2024
15 checks passed
@henryzhx8 henryzhx8 added the bug Something isn't working label Nov 13, 2024
@henryzhx8 henryzhx8 added this to the v2.1 milestone Nov 13, 2024
@henryzhx8 henryzhx8 deleted the feature/taiye/fix_docker_compose_container_info branch November 13, 2024 07:31
linrunqi08 added a commit that referenced this pull request Nov 14, 2024
…quence when docker compose is repeatedly up. (#1875)
linrunqi08 added a commit that referenced this pull request Dec 12, 2024
…event sequence when docker compose is repeatedly up. (#1875)"

This reverts commit 9005b10.
linrunqi08 added a commit that referenced this pull request Dec 13, 2024
…event sequence when docker compose is repeatedly up. (#1875)" (#1962)

This reverts commit 9005b10.
linrunqi08 added a commit that referenced this pull request Dec 13, 2024
…event sequence when docker compose is repeatedly up. (#1875)" (#1962)

This reverts commit 9005b10.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants