VOLUME

The Dockerfile instruction that marks a path as holding data that should live in a volume rather than the container layer.

In more detail

If you run the image without mounting anything there, Docker creates an anonymous volume at that path. It cannot be undone by later images built on top, so use it sparingly, typically for database data directories.

Example

VOLUME /var/lib/postgresql/data

Related terms

Taught in

References

Certification courses