Consider a Dockerfile that declares two volumes
FROM someimage # ... VOLUME ["/foo", "/bar"]
and a container started from that image, that does a bind mount for one of those volumes:
docker run --name mycontainer -d -v /some/path:/foo myimage
If I created a new image from that container using
docker commit mycontainer myexportedimage
/bar, will be excluded in the exported image.
How do I create a runnable (i.e. maintaining meta data from Dockerfile) image from
mycontainer that includes the data from both paths,
/foo (bind mounted) and
/bar (volume as declared by Dockerfile), so if I exported the image to another Docker host, all data would be present?