Docker Community Forums

Share and learn in the Docker community.

Need help figuring out a dockerfile

Hello Folks,

I’m new to docker and i’m experimenting with docker on Windows Server 2016.

I have the following docker file:


escape=`

FROM microsoft/nanoserver
COPY C:\source\Sample2\packages\Microsoft-NanoServer-IIS-Package.cab c:\packages
COPY C:\source\Sample2\packages\Unattend.xml c:\packages
RUN dism /online /apply-unattend:c:\packages\unattend.xml
COPY content /inetpub/wwwroot/


i am trying to build the images using PowerShell with the following command:

get-content dockerfile | docker build -t /dotnettestapp -

i keep getting an error on the COPY. i tried multiple ways no success

Step 1/5 : FROM microsoft/nanoserver
—> 787d9f9f8804
Step 2/5 : COPY C:\source\Sample2\packages\Microsoft-NanoServer-IIS-Package.cab c:\packages
GetFileAttributesEx C:sourceSample2packagesMicrosoft-NanoServer-IIS-Package.cab: The system cannot find the file specified.
PS C:\source\sample2>

Any help would be greatly appreciated .

Thanks

The source for COPY instructions is is path-relative to where your build context is: https://msdn.microsoft.com/en-us/virtualization/windowscontainers/docker/manage_windows_dockerfile#copy

ran the docker build command in a command prompt instead of powershell using “docker build -t pierreroman/iis-dockerfile C:\source\Sample2” and it worked. the copy error went away.