moby: ENV substitution problem with Windows builder
I’ve tried various combinations of $PATH
and %PATH%
and :
and ;
, but I just can’t seem to get ENV
concatenation to work with Dockerfiles for Windows.
Other people seem to have given up too and just run RUN setx
: https://github.com/StefanScherer/dockerfiles-windows/blob/197ac3a9a8fe8494915b9b62f517fa67151833cc/golang/Dockerfile#L9
setx /m
may be the most correct workaround for now.
/cc @jhowardmsft @icecrime @dmp42
Output of docker info
:
docker info
Containers: 71
Running: 0
Paused: 0
Stopped: 71
Images: 45
Server Version: 1.11.0-dev
Storage Driver: windowsfilter
Windows:
Logging Driver: json-file
Plugins:
Volume: local
Network: null nat
Kernel Version: 10.0 14316 (14316.1000.amd64fre.rs1_release.160402-2217)
Operating System: Windows Server 2016 Datacenter Technical Preview 5
OSType: windows
Architecture: x86_64
CPUs: 4
Total Memory: 1.242 GiB
Name: WIN-8F5EG07ROBB
ID: VKYM:E5F7:CMIT:4ZMS:OGUG:W43U:API4:ATWI:3S5X:RO54:DU4Q:YOFD
Docker Root Dir: C:\ProgramData\docker
Debug mode (client): false
Debug mode (server): true
File Descriptors: -1
Goroutines: 24
System Time: 2016-04-13T18:46:29.3959003-07:00
EventsListeners: 0
Username: friism4test
Registry: https://index.docker.io/v1/
Output of docker version
:
docker version
Client:
Version: 1.11.0-rc3
API version: 1.23
Go version: go1.5.3
Git commit: eabf97a
Built: Fri Apr 1 23:33:49 2016
OS/Arch: windows/amd64
Server:
Version: 1.11.0-dev
API version: 1.24
Go version: go1.5.3
Git commit: 577adcc
Built: Mon Apr 11 17:20:50 2016
OS/Arch: windows/amd64
Steps to reproduce the issue:
> "FROM windowsservercore`n RUN echo %PATH%`n ENV PATH c:\\go\\bin;`$PATH" | docker build -t test -
Sending build context to Docker daemon 2.048 kB
Step 1 : FROM windowsservercore
---> e1e5fb4dbc32
Step 2 : RUN echo %PATH%
---> Running in 91a3c7417bc3
C:\Windows\system32;C:\Windows;%localappdata%\Microsoft\WindowsApps;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\
---> 818d81426779
Removing intermediate container 91a3c7417bc3
Step 3 : ENV PATH c:\\go\\bin;$PATH
---> Running in f6ab92ac3110
---> d6b86fdef7e5
Removing intermediate container f6ab92ac3110
Successfully built d6b86fdef7e5
> docker run test cmd /c echo %PATH%
c:\go\bin;
Describe the results you received:
Incorrect PATH
Describe the results you expected:
Correctly concatenated PATH
About this issue
- Original URL
- State: open
- Created 8 years ago
- Reactions: 3
- Comments: 17 (13 by maintainers)
A workaround using only PowerShell (this so happened to be to get dotnet cli on the path on a nano server):