Skip to content

[Docker Compatibility] Cannot combine --rm and -d flags in finch run #1662

@tinovyatkin

Description

@tinovyatkin

Summary

Finch rejects the combination of --rm and -d (--detach) flags in finch run, while Docker and Podman allow this combination. This is a common pattern used in development workflows.

Upstream Issue

This is an nerdctl limitation tracked at: containerd/nerdctl#1187 (open since July 2022)

Docker Behavior

# This works in Docker - runs detached and auto-removes on exit
docker run --rm -d --name mongo -p 27017:27017 mongo:latest

Finch/nerdctl Behavior

# This fails with error
finch run --rm -d --name mongo -p 27017:27017 mongo:latest
# FATA[0000] flag -d and --rm cannot be specified together

Podman Compatibility

Podman allows combining --rm and -d flags, matching Docker's behavior.

Use Cases

  1. Development Scripts: Many development scripts use docker run --rm -d to start services that auto-cleanup when stopped
  2. CI/CD Pipelines: Temporary containers that run in background and self-cleanup
  3. VS Code Docker Extension: Container lifecycle management workflows

Impact

This breaks compatibility with existing Docker scripts and workflows that rely on this flag combination. Users migrating from Docker to Finch encounter unexpected errors.

Workaround

A workaround for VS Code Docker extension is implemented in PR #327 - the extension avoids this flag combination when targeting Finch.

For CLI users, the workaround is to either:

  1. Skip --rm and manually remove containers
  2. Skip -d and run in foreground (not always practical)

Suggested Action

Consider contributing the implementation upstream to nerdctl to maintain Docker CLI compatibility.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions