commands
commanddocker run -d --rm -v ${PWD}/test.txt:/test.txt busybox cat /test.txt
descriptionRun a temporary container that prints the contents of test.txt and exits.
purposeThis command is used to quickly read the contents of a local file (`test.txt`) from inside a Docker container. It's useful for testing volume mounts, validating file access inside containers, or using containerized tools on host files without installing anything.
parts
flagdocker run-d--rm-v ${PWD}/test.txt:/test.txtbusyboxcat /test.txt
meaningStart a new container from a specified imageDetached mode — run the container in the backgroundAutomatically remove the container after it exitsMount the local file 'test.txt' from the current directory into the container at path '/test.txt'Use the 'busybox' container image (a minimal Linux environment)Run the 'cat' command inside the container to print the contents of '/test.txt'