Cannot delete files from wwwroot with Dockerfile

I’m trying this on Windows Server Core 2016 TP5. I have this simple Dockerfile:

FROM microsoft/iis

RUN powershell remove-item c:\inetpub\wwwroot\iisstart.*

The microsoft/iis image contains a couple of files (iisstart.htm and iisstart.png) in c:\inetpub\wwwroot. I’m trying to remove those files.

  • Docker container volume doesn't write to host
  • Docker cannot create a machine - 'Error in driver during machine creation'
  • Why use docker? Aren't java files like WAR files already running on JVM?
  • Grafana + InfluxDB configuration
  • How to hot deploy Java EE applications in Docker containers
  • alpine package py-pip missing
  • Here’s the output from docker build:

    c:\git\temp\test>docker build -t foo .
    Sending build context to Docker daemon 2.048 kB
    Step 1 : FROM microsoft/iis
     ---> c26f4ceb81db
    Step 2 : RUN powershell remove-item c:\inetpub\wwwroot\iisstart.*
     ---> Running in 4d17a5ab86e5
     ---> d5f85251b3db
    Removing intermediate container 4d17a5ab86e5
    Successfully built d5f85251b3db

    If I now start up a container and look in wwwroot, the files are still there.

    docker run --rm -it foo cmd

    Microsoft Windows [Version 10.0.14300]
    (c) 2016 Microsoft Corporation. All rights reserved.
    C:\>cd inetpub\wwwroot
     Volume in drive C has no label.
     Volume Serial Number is 5664-BDCB
     Directory of C:\inetpub\wwwroot
    05/19/2016  07:05 PM    <DIR>          .
    05/19/2016  07:05 PM    <DIR>          ..
    05/05/2016  03:27 PM               703 iisstart.htm
    05/05/2016  03:27 PM            99,710 iisstart.png
                   2 File(s)        100,413 bytes
                   2 Dir(s)  21,209,399,296 bytes free

    While inside the running container, if I execute powershell remove-item c:\inetpub\wwwroot\iisstart.*, the files get deleted fine. Why doesn’t the same command work in the dockerfile?

    I’ve also tried del c:\inetpub\wwwroot\iisstart.* with similar results.

  • Docker, Django and Selenium - Selenium unable to connect
  • Kubernetes pod is reported as running while it is not
  • Docker on Linux - Empty mounted volumes
  • docker-compose up “Cannot start service frontend: oci runtime error: not a directory”
  • Docker Compose: Accessing my webapp from the browser
  • Official Filebeat docker running on windows not allowing application to rotate the log
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.