Untitled
unknown
plain_text
2 years ago
624 B
5
Indexable
#!/bin/bash # Step 1: Build and run the Java application docker build -t yourname_java_app -f Dockerfile_java . docker run --rm yourname_java_app # Step 2: Create two files in a volume using the Dockerfile_volume docker build -t yourname_volume -f Dockerfile_volume . docker volume create yourname_docker_volume docker run -v yourname_docker_volume:/data --name volume_container yourname_volume # Print the output of the files created in the volume echo "Content of file1.txt:" docker exec volume_container cat /data/file1.txt echo "Content of file2.txt:" docker exec volume_container cat /data/file2.txt
Editor is loading...