microcks / microcks/microcks-cli

bug: stale instance entries accumulate in config when container is recreated

Open Beginner friendly
#483 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stale
Dominant language
Go
Stars
52
Forks
68
Avg merge
6h 54m
Merged PRs (30d)
10

Description

### Describe the bug

## Description

When a container is removed externally (e.g. `docker stop && docker rm`) and
`microcks start` recreates it, the old instance entry is never removed from config.
A new entry is appended instead, causing duplicate instance records to accumulate.

### Expected behavior

_No response_

### Actual behavior

_No response_

### How to Reproduce?

## Steps to Reproduce

1. `./microcks start`
2. `docker stop microcks && docker rm microcks`
3. `./microcks start`
4. `cat ~/.config/microcks/config` two instance entries with same name but different container IDs

## Screenshots

Image

Image

## Root Cause

`RemoveInstance` matched by `Name` instead of `ContainerID`. Since the recreated
container has a new ID, `UpsertInstance` never finds a match and always appends.

### Microcks version or git rev

_No response_

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

_No response_

### Additional information

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the microcks start flow and trace RemoveInstance and UpsertInstance, using the configuration at ~/.config/microcks/config and the container recreation steps as the reproduction. Confirm that recreating a container with a new ID does not leave duplicate entries for the same instance name, then verify the config contains one current record after restarting.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.