Logging into a locally started instance clears its container reference, causing stop to do nothing

未关闭 适合新手
#620 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
79/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
docker, go
领域
cli

调研方向

从 cmd/login.go 开始,issue 指出 login 会替换已保存的上下文,接着追踪该上下文的写入方式。使用单独的配置文件,通过 issue 中的三个命令重现问题,然后检查 login 是否保留实例字段,以及 microcks stop 是否随后停止容器。

由索引模型根据 Issue 内容生成。

描述

Describe the bug

After starting a local Microcks instance with the CLI, logging into the same server clears the instance reference from its saved context.

A subsequent microcks stop reports that no instance is associated with the context and exits successfully, even though the container is still running.

I reproduced this using a separate config file and an authentication-disabled Microcks instance.

Expected behavior

Logging into the same server should preserve its existing local instance reference. Running microcks stop afterward should stop the container created by microcks start.

Actual behavior

Before login, the saved context contains:
instance: microcks-login-repro
After login, it becomes:
instance: ""
Running stop then prints: No instance is associated with this context
The command exits with code 0, but Docker still reports the container as running. The Microcks API also continues to return HTTP 200.

How to Reproduce?

With Docker running, execute the following commands using a separate config file:

microcks start --name microcks-login-repro --port 18585 --rm --ready-timeout 120s --config repro-config.yaml
microcks login http://localhost:18585 --config repro-config.yaml
microcks stop --config repro-config.yaml

Check whether the container is still running:

docker inspect --format '{{.State.Running}}' microcks-login-repro

The output is: true
You can also compare repro-config.yaml before and after login to see that the context’s instance field has been cleared.
As a control, restoring the config saved before login and repeating the same stop command successfully stopped and removed the container.

To clean up manually after reproducing:

docker stop microcks-login-repro
Microcks version or git rev

36f1028f877a5f4502633f574aac627e7d25dc53

Install method (docker-compose, helm chart, operator, docker-desktop extension,...)

No response

Additional information

The likely cause is in cmd/login.go: login replaces the existing context with a ContextRef containing only Name, Server, and User, leaving out the Instance field previously saved by start.

主要语言
Go
星标
59
派生
75
平均合并
4 天 5 小时
30 天内合并 PR
15

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microcks/microcks-cli 的其他 Issue

查看 microcks/microcks-cli 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。