What is the VOLUME instruction good for in Docker?

Experience Level: Senior
Tags: Docker

Answer

The VOLUME instruction creates a mount point with the specified name and marks it as holding externally mounted volumes from native host or other containers. The value can be a JSON array, VOLUME ["/var/log/"], or a plain string with multiple arguments, such as VOLUME /var/log or VOLUME /var/log /var/db.

Example:
FROM ubuntu
VOLUME /myvol

Comments

No Comments Yet.
Be the first to tell us what you think.
Docker instructions
Docker instructions

Are you learning Docker ? Try our test we designed to help you progress faster.

Test yourself