Skip to content

Conversation

@NiloCK
Copy link
Collaborator

@NiloCK NiloCK commented May 16, 2025

Problem

When working with git worktrees or multiple clones of the repository on
the same machine, the CouchDB Docker container setup can cause
conflicts. This happens because:

  1. Multiple worktrees try to use the same container name
    (skuilder-test-couch)
  2. Docker attempts to mount volumes to paths that may already exist in
    other containers
  3. This results in errors like:
    Error response from daemon: failed to create task for container:
    

failed to create shim task: OCI runtime create failed: runc create
failed: unable to start container process: error during container init:
error mounting "/path/to/local.ini" to rootfs at
"/opt/couchdb/etc/local.ini"


## Solution

Automatic cleanup process in the `dev-couchdb.js` script that runs
before starting CouchDB. This process:

1. Checks if a container with the name `skuilder-test-couch` already
exists
2. If it exists:
- Stops the container if it's running
- Removes the container
3. Continues with the normal start process using the test-couch.sh
script

This ensures that each time you start CouchDB, you get a fresh container
without conflicts from previous runs or other worktrees.

## Problem

When working with git worktrees or multiple clones of the repository on
the same machine, the CouchDB Docker container setup can cause
conflicts. This happens because:

1. Multiple worktrees try to use the same container name
(`skuilder-test-couch`)
2. Docker attempts to mount volumes to paths that may already exist in
other containers
3. This results in errors like:
   ```
   Error response from daemon: failed to create task for container:
failed to create shim task: OCI runtime create failed: runc create
failed: unable to start container process: error during container init:
error mounting "/path/to/local.ini" to rootfs at
"/opt/couchdb/etc/local.ini"
   ```

## Solution

Automatic cleanup process in the `dev-couchdb.js` script that runs
before starting CouchDB. This process:

1. Checks if a container with the name `skuilder-test-couch` already
exists
2. If it exists:
   - Stops the container if it's running
   - Removes the container
3. Continues with the normal start process using the test-couch.sh
script

This ensures that each time you start CouchDB, you get a fresh container
without conflicts from previous runs or other worktrees.
@NiloCK NiloCK merged commit b38615d into master May 16, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants