Search code examples
dockerdocker-for-windowsdocker-desktop

Docker Windows new container options


When I create a new container in docker windows, there are optional settings to give it a name, and under 'Volumes' there is 'Host Path' and 'Container Path'. Are these for somehow connecting local host with the container? How does it work?

Screenshot


Solution

  • Volumes in the new Docker Desktop correspond to Docker volumes. You can also use volumes with the Docker CLI's -v flag when you run a container. This mounts a path from your host machine's filesystem (Windows) to your Docker container's filesystem.

    For example, if you set Host Path: C:\User\Username\Projects and Container Path: /home/projects, the contents of your Projects directory on Windows would be "shared" (actually bind-mounted) to your Docker container. The corresponding Docker command would be: docker run -v C:\Users\Username\Projects:/home/projects MP4

    See the bind-mounts docs for more information.