The -v parameter in the docker run command is used to mount a volume or bind mount a directory from the host machine into the Docker container. This allows you to share files between the host and the container, enabling data persistence and easier access to files.
The syntax for using the -v parameter is:
docker run -v <host_path>:<container_path> <image_name>
<host_path>: The path on the host machine that you want to mount.<container_path>: The path inside the container where the host path will be mounted.<image_name>: The name of the Docker image you are running.
For example:
docker run -v /path/on/host:/path/in/container ubuntu
This command mounts the directory /path/on/host from the host into the container at /path/in/container.
