-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add-AccountToDockerAccess fails in pwsh 7.0 #4
Comments
Thanks for opening the issue. As PS 7 is using .net Core, I probably need to use different classes and / or methods. Unfortunately, I won't have time for that in the foreseeable future but would keep this issue open as a reminder |
I got this same error while using Powershell (Preview) The Solution Open up the standard Powershell ( |
You should also be able to do this from pwsh: powershell Install-Module -Name dockeraccesshelper
powershell Add-AccountToDockerAccess $UserName |
My Power shell version Table : > $PSVersionTable
Name Value
---- -----
PSVersion 7.1.3
PSEdition Core
GitCommitId 7.1.3
OS Microsoft Windows 10.0.19044
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0 as Admin user in powershell 7 i've done it with this command: > $acl = Get-Acl "\\.\pipe\docker_engine"
> $acl.access
FileSystemRights : FullControl
AccessControlType : Allow
IdentityReference : AUTORITE NT\Système
IsInherited : False
InheritanceFlags : None
PropagationFlags : None
FileSystemRights : FullControl
AccessControlType : Allow
IdentityReference : BUILTIN\Administrateurs
IsInherited : False
InheritanceFlags : None
PropagationFlags : None
> $rule = New-Object System.Security.AccessControl.FileSystemAccessRule("<Domain>\<user>","FullControl","Allow")
> $acl.SetAccessRule($rule)
> $acl.Access
FileSystemRights : FullControl
AccessControlType : Allow
IdentityReference : AUTORITE NT\Système
IsInherited : False
InheritanceFlags : None
PropagationFlags : None
FileSystemRights : FullControl
AccessControlType : Allow
IdentityReference : BUILTIN\Administrateurs
IsInherited : False
InheritanceFlags : None
PropagationFlags : None
FileSystemRights : FullControl
AccessControlType : Allow
IdentityReference : <Domain>\<user>
IsInherited : False
InheritanceFlags : None
PropagationFlags : None
> Set-Acl "\\.\pipe\docker_engine" -AclObject $acl From <user> powershell i can now use docker command: PS C:\Users\<user>> docker info
Client:
Context: default
Debug Mode: false
Server:
Containers: 1
Running: 0
Paused: 0
Stopped: 1
Images: 1
Server Version: 20.10.13
Storage Driver: windowsfilter
Windows:
Logging Driver: json-file
Plugins:
Volume: local
Network: ics internal l2bridge l2tunnel nat null overlay private transparent
Log: awslogs etwlogs fluentd gcplogs gelf json-file local logentries splunk syslog
Swarm: inactive
Default Isolation: hyperv
Kernel Version: 10.0 19044 (19041.1.amd64fre.vb_release.191206-1406)
Operating System: Windows 10 Enterprise Version 2009 (OS Build 19044.2130)
OSType: windows
Architecture: x86_64
CPUs: 4
Total Memory: 8GiB
Name: <hostname>
ID: <id>
Docker Root Dir: C:\ProgramData\docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine |
You can run this code on PowerShell 7 $account="$env:USERDOMAIN\$env:USERNAME"
$npipe = "\\.\pipe\docker_engine"
$dInfo = New-Object "System.IO.DirectoryInfo" -ArgumentList $npipe
#$dSec = $dInfo.GetAccessControl()
$dSec = Get-Acl -Path $dInfo
$fullControl =[System.Security.AccessControl.FileSystemRights]::FullControl
$allow =[System.Security.AccessControl.AccessControlType]::Allow
$rule = New-Object "System.Security.AccessControl.FileSystemAccessRule" -ArgumentList $account,$fullControl,$allow
$dSec.AddAccessRule($rule)
#$dInfo.SetAccessControl($dSec)
Set-Acl -Path $dInfo -AclObject $dSec |
When running in pwsh 7.0 the following errors are generated:
My $PSVersionTable:
Running
Add-AccountToDockerAccess
in a powershell session with version 5.1.17763.1007 runs to completion successfully.The text was updated successfully, but these errors were encountered: