dockercontainerspodman

Corresponding docker command of `podman run --replace`


In podman, use --replace to replace existing container

According to podman-run — Podman documentation

--replace

If another container with the same name already exists, replace and remove it. The default is false.

What is the corresponding command in docker?

Not find in docker run | Docker Docs


Solution

  • There's no equivalent docker run option; the documentation you link to would show it if there was.

    It should be more or less equivalent to explicitly stop and delete the existing container

    docker stop "$CONTAINER_NAME" || true
    docker rm "$CONTAINER_NAME" || true
    docker run --name "$CONTAINER_NAME" ...