Search code examples
dockerwindows-10volumedocker-volumelinux-containers

Docker volume not showing running linux container on Windows 10


I am running Docker for Windows v19.03.12. I am running a linux container from Windows 10. I am sharing my entire c:\ drive with Docker (see image). I am trying to testing a container locally and need to pass a credentials file to the container.

When I run the following command:

docker run --rm -p 9215:80 -p 44371:443 --name test -t createshipment:latest -v c:/temp:/data  

When I explore the container I do not see a /data folder at all (see image).

enter image description here

I am not sure what else to try to share a folder when testing docker locally.


Solution

  • The command docker run expects the image name as the last argument, before any arguments to the image's entrypoint. In the OP's post, the image name precedes the -v ... argument, so -v ... is actually passed to the image's entrypoint.

    docker run --rm -p 9215:80 -p 44371:443 --name test -t \
      -v c:/temp:/data createshipment:latest
    

    For the sake of completeness, here are the relevant excerpts from the documentation for the command-line options used here:

    Usage:  docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
    
    ... 
    
        --name string     Assign a name to the container
    -p, --publish list    Publish a container's port(s) to the host
        --rm              Automatically remove the container when it exits
    -t, --tty             Allocate a pseudo-TTY
    -v, --volume list     Bind mount a volume