Create image from container without "binds"

Hello I have a question regarding images. I like to create an image from a running container.

Via docker commit I was able to create an image. Unfortunately there are “binds” e.g.

            "": "C:\\xyz\\Docker\\test\\testfile",
            "": "hostFile",
            "": "/tmp/testfile",

When I try to create a new container from a different location I receive error messages like this

“Error response from daemon: cannot mount volume over existing file,”

  • Is is possible to remove\ignore the binds at Commit ?
  • What is the correct way to export and import a new Image based on a container

Thanks in advanced

  1. Which version of Docker Desktop does it? Labels should not matter. I tried it with Docker Desktop 4.5 and after update with Docker Desktop 4.6. None of them mounted anything automatically.
  2. Can you share the exact commands to reproduce the issue?

For me, your error message looks like you try to mount a volume to a file, like:

docker run --rm -it --name bash -v /etc/hosts bash

Doesn’t matter where you run it, it will fail.