I am new to Docker and wonder if this would work and not cause any problems in creating a docker data only container and protect it from accidental deletion.
docker run -itd -v /mydata --name DATA busybox sh
16a368d2b6db busybox “sh” 6 seconds ago Up 4 seconds DATA
docker pause DATA
I hope pausing it keeps it from using any host cpu. Once it is in this state you would have to unpause, then stop the container before you could delete it and the data volume. Even -f fails
docker rm -f -v DATA
Error response from daemon: Cannot destroy container DATA: Could not kill running container, cannot remove - Container 16a368d2b6dba8100483df13e5fdec76be52158ee4678613792e2c57a6d9144c is paused. Unpause the container before stopping
Error: failed to remove containers: [DATA]
Any holes in this method or why I shouldn’t use it?