Skip to content

Cannot set path in Windows 1809 #236

Closed
@brianharwell

Description

@brianharwell

Steps to reproduce

The following Dockerfile results in an image that either fails to build or does not set the path environment variable...

FROM mcr.microsoft.com/powershell:nanoserver-1809 as runtime
SHELL ["pwsh.exe", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

# RUN setx Path "C:\foo" -> ERROR: The system cannot find registry path specified.

# RUN setx /M Path "C:\foo" -> ERROR: Access to the registry path is denied.

# RUN [Environment]::SetEnvironmentVariable("Path", "C:\foo", "User") -> Missing ')' in method call.

# RUN [Environment]::SetEnvironmentVariable('Path', 'C:\foo', 'User') -> $env:Path returns C:\Windows\system32;C:\Windows;C:\Program Files\PowerShell;

# RUN [Environment]::SetEnvironmentVariable('Path', 'C:\foo', 'Machine') -> Exception calling "SetEnvironmentVariable" with "3" argument(s): "Requested registry access is not allowed."

# RUN $env:Path = 'C:\foo' -> $env:Path returns C:\Windows\system32;C:\Windows;C:\Program Files\PowerShell;

Expected behavior

To be able to set the path environment variable

Environment data

Server Version: 18.09.2
Storage Driver: windowsfilter
Windows:
Logging Driver: json-file
Plugins:
Volume: local
Network: ics l2bridge l2tunnel nat null overlay transparent
Log: awslogs etwlogs fluentd gelf json-file local logentries splunk syslog
Swarm: inactive
Default Isolation: hyperv
Kernel Version: 10.0 17763 (17763.1.amd64fre.rs5_release.180914-1434)
Operating System: Windows 10 Enterprise Version 1809 (OS Build 17763.316)
OSType: windows
Architecture: x86_64
Docker Root Dir: C:\ProgramData\Docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: -1
Goroutines: 70
System Time: 2019-06-04T16:59:47.1402861-05:00
EventsListeners: 1
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine

Name Value


PSVersion 6.2.1
PSEdition Core
GitCommitId 6.2.1
OS Microsoft Windows 10.0.17763
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions