Last updated
Last updated
In this lesson, we will use the VOLUME instruction to automatically create a mount point in a Docker image. When a container is created using this image, a volume will be created and mounted to the specified directory.
Step 1: Set up your environment:
Step 2: Create the Dockerfile:
Step 3: Build an Nginx image that uses a volume:
Step 4: Build the new image:
Step 5: Create a new container using the nishanthkp/nginx:v1 image:
Step 6: Inspect nginx-volume:
Step 7: List the volumes:
Step 8: Inspect the volumes: