Creating a Data Volume Container in Dockerfile
Create a Docker data volume container in Dockerfile is unbelievably simple, just use the VOLUME instruction:
|
|
The instruction creates a mount point and attach the volumes from native host or other containers.
Build the data container:
|
|
The built size is just about 125.1 MB.
|
|
The first data
is the name of the container, the second data
is the name of Docker image.
To attach the data volume container to another, we use --volumes-from
option:
|
|
If there’re initial data to copy, then add the COPY
instruction:
|
|
Settings:
|
|