Actual Behavior
Created a small test docker image from microsoft/windowsservercore, installed cmake using chocolatey (through Win10 PackageManagement) and then added cmake to the system PATH variable. I can build the image but when I run a container from it, the PATH is not getting updated correctly. The application cmake is installed correctly in the container and I have confirmed that.
See below for my dockerfile.
Expected Behavior
The PATH system variable should be updated correctly with the path to the cmake executable directory appeneded to it.
Related Information
I have ‘Docker for windows’ installed on windows 10 Pro 64 bit. I am currently running this in windows containers mode.
Here is my dockerfile:
FROM microsoft/windowsservercore
LABEL version="v2"
SHELL ["powershell", "-Command"]
RUN Get-PackageProvider -Force -Name Chocolatey
RUN Get-PackageProvider -Force -Name NuGet
RUN Register-PackageSource -Name NuGetGallery -Location https://www.nuget.org/api/v2/ -Provider Nuget -Trusted
RUN Install-Package -Force -Name cmake -RequiredVersion '3.7.2' -ProviderName Chocolatey
ENV PATH "C:\Program Files\CMake\bin:%PATH%"
Here is the output of docker version:
Client:
Version: 17.03.1-ce
API version: 1.27
Go version: go1.7.5
Git commit: c6d412e
Built: Tue Mar 28 00:40:02 2017
OS/Arch: windows/amd64
Server:
Version: 17.03.1-ce
API version: 1.27 (minimum version 1.24)
Go version: go1.7.5
Git commit: c6d412e
Built: Tue Mar 28 00:40:02 2017
OS/Arch: windows/amd64
Experimental: true
What I have already tried
I tried following combinations to update the PATH but none of these work:
ENV PATH="C:\Program Files\CMake\bin:%{PATH}%"
ENV PATH "C:\Program Files\CMake\bin":PATH
ENV PATH "C:\Program Files\CMake\bin:%PATH%"
ENV PATH C:\Program Files\CMake\bin
RUN PATH %PATH%;C:\Program Files\CMake\bin
Steps to Reproduce
Install Docker for windows.
Switch to windows containers
Create a small test dockerfile with the following:
FROM microsoft/windowsservercore
ENV PATH "C:\Program Files:%PATH%"
(Add any directory to the system variable PATH in the Dockerfile, I just mentioned C:\Program Files as an example to reproduce the issue)
Any help/feedback is appreciated…
Thanks.