Skip to content

Inconsistent Dockerfile behavior between Windows Containers and Linux #27545

@MichaelSimons

Description

@MichaelSimons

Description

It appears the Windows Containers behavior of the COPY command is slightly different than on Linux when the destination is .

Steps to reproduce the issue:

  1. Get a working Windows Container environment.
  2. Create a directory with some files with one of them named project.json
  3. Add the following Dockerfile to the directory. Note: This is a simplified Dockerfile. In the real usage there are commands in between the COPY commands that don't need to be re-run if the project.json doesn't change.
FROM microsoft/nanoserver

WORKDIR app
COPY project.json .
COPY . .

Describe the results you received:
Output of building is:

Sending build context to Docker daemon 6.144 kB
Step 1/4 : FROM microsoft/nanoserver
 ---> 105d76d0f40e
Step 2/4 : WORKDIR app
 ---> Using cache
 ---> 5c0466311dc7
Step 3/4 : COPY project.json .
 ---> Using cache
 ---> 0d4a942fa0c6
Step 4/4 : COPY . .
mkdir \\?\Volume{c0949f92-8c99-11e6-b9a3-adda2ced055a}\app: The system cannot find the path specified.

Describe the results you expected:
The same Dockerfile with the exception of FROM debian:jessie builds and produces the expected results (all files are copied into the app dir) in my Ubuntu environment.

Additional information you deem important (e.g. issue happens only occasionally):
There are two ways to get the Dockerfile to work on Windows Containers

  1. Add RUN mkdir c:\app before the WORKDIR command
  2. Change the two COPY destinations to ./

Output of docker version:

Client:
 Version:      1.12.2-cs2-ws-beta
 API version:  1.25
 Go version:   go1.7.1
 Git commit:   050b611
 Built:        Tue Oct 11 02:35:40 2016
 OS/Arch:      windows/amd64

Server:
 Version:      1.12.2-cs2-ws-beta
 API version:  1.25
 Go version:   go1.7.1
 Git commit:   050b611
 Built:        Tue Oct 11 02:35:40 2016
 OS/Arch:      windows/amd64

Output of docker info:

Containers: 18
 Running: 1
 Paused: 0
 Stopped: 17
Images: 302
Server Version: 1.12.2-cs2-ws-beta
Storage Driver: windowsfilter
 Windows:
Logging Driver: json-file
Plugins:
 Volume: local
 Network: nat null overlay
Swarm: inactive
Default Isolation: process
Kernel Version: 10.0 14393 (14393.206.amd64fre.rs1_release.160915-0644)
Operating System: Windows Server 2016 Standard Evaluation
OSType: windows
Architecture: x86_64
CPUs: 1
Total Memory: 1.159 GiB
Name: WIN-F6RFOUBH784
ID: R644:EESZ:OP6H:7Z62:UABL:VAFV:7TZC:BIR7:KXD7:ISDG:SP37:FXUY
Docker Root Dir: C:\ProgramData\docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions