Perform the following the steps:
-
Let's begin by creating a named volume using the docker volume create command, as shown in the following code:
$ docker volume create datavol datavol
- List the volume using the docker volume ls command, as shown in the following code:
$ docker volume create ls DRIVER VOLUME NAME local datavol
- Launch an interactive container using the docker container run command and -v option to mount the datavol volume to the container, as shown in the following code:
$ docker container run -it --rm -v datavol:/data alpine / #
- Now, let's create a new file at the /data directory of the container and write some text to it:
/ # echo "This is a named volume demo" > /data/demo.txt / #
- Exit from ...