Docker export reproducibility

Are there any guarantees or alternatives to make docker export reproducible?
I mean, given a docker image, always produce the exact same tar file?

This usually boils down to files timestamps and files order.

docker export exports the filesystem of a container (not image) only. Are you sure this is what you want and not saving the container as an image or saving the base image?

Since docker export exports (if I’m not mistaken) the whole filesystem of the container, which can contain newly created files, temporary files I don’t think you can always export the same content.

If you can share what you want to achieve with this, maybe we can recommend a better solution.

Sorry for the misleading message.

Given a docker image image_id
Will “docker create image_id” followed by “docker export container_id” guaranteed to always produce the same tar?

The answer is the same. I just pointed out the image is not a container and docker export exports containers’ filesystem.