Create a volume, copy files and list files in Docker Named Volume
Create a container with volume¶
docker container create --name test_container -v test_vol:/test-data busybox;
Copy files¶
echo "Hello World" > test.txt;
docker cp ./test.txt test_container:/test-data;
docker rm test_container;
List files¶
docker run -it --rm -v test_vol:/vol busybox ls -l /vol
Show content of file¶
docker run -it --rm -v test_vol:/vol busybox cat /vol/test.txt
Remove docker volume¶
docker volume rm test_vol
Last update 2022-11-25