Search code examples
dockerdockerfilewindows-container

ADD command with network path in Windows Containers Dockerfiles


I'm creating some Windows Container images that I need but the source file I want to ADD are in a network share \\myserver\myshare\here.
I've tried in any possible way but I always get the message error The system cannot find the path specified.

Is it because I have not yet found the right way to set it or is it that it is just not possible?

From the Docker site:

Multiple resource may be specified but if they are files or directories then they must be relative to the source directory that is being built (the context of the build).

Is that why I can't accomplish what I need?

Full error message: GetFileAttributesEx \\myserver\myshare\here\: The system cannot find the path specified.


Solution

  • Whatever you ADD or COPY must be in the docker build context.

    When you do this:

    docker build .
    

    That directory param (the . in the example) is the context that is copied and sent to the Docker daemon. Then the docker daemon use those files to COPY or ADD. It won't use any file that is not in that context.

    That is the issue that you are experiencing. I'm not sure how you can solve it anything than copying the files from \\myserver to your build directory.

    ADD is capable of download files by providing an URL (should investigate if it supports Windows' shares)