question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Access to the path is denied

See original GitHub issue

When I run:

docker run --rm `
>>   -e SERVER_NAME=my-domain `
>>   -e IP_ADDRESSES=$ips,public-ip `
>>   -v "C:\ProgramData\docker:C:\ProgramData\docker" `
>>   -v "$env:USERPROFILE\.docker:C:\Users\ContainerAdministrator\.docker" `
>>   stefanscherer/dockertls-windows

I have this error:

mkdir : Access to the path 'C:\ProgramData\docker\certs.d' is denied.
At C:\generate-certs.ps1:17 char:7
+       mkdir $dir
+       ~~~~~~~~~~
+ CategoryInfo          : PermissionDenied: (C:\ProgramData\docker\certs.d:String) [New-Item], UnauthorizedAccessException
+ FullyQualifiedErrorId : CreateDirectoryUnauthorizedAccessError,Microsoft.PowerShell.Commands.NewItemCommand

And, when I run:

mkdir ~\.docker
docker run --rm `
>>   -e SERVER_NAME=my-domain `
>>   -e IP_ADDRESSES=$ips,public-ip `
>>   -v "$env:USERPROFILE\.docker:C:\Users\ContainerAdministrator\.docker" `
>>   stefanscherer/dockertls-windows

I have this output:

    Directory: C:\ProgramData\docker

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----         4/29/2019  2:45 AM                certs.d
d-----         4/29/2019  2:45 AM                config

    Directory: C:\Users\ContainerUser

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----         4/29/2019  2:45 AM                .docker

    Directory: C:\

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----         4/29/2019  2:45 AM                DockerSSLCARoot

=== Generating CA private password

=== Writing out private key password

=== Generating CA private key
Generating RSA private key, 4096 bit long modulus
......................++
......................................................++
e is 65537 (0x10001)

=== Generating CA public key - expires in 365 days

=== Reading in CA Private Key Password

=== Generating Server private key
server-key.pem: Permission denied
1204969060:error:02FFF00D:system library:func(4095):Permission denied:bio/bss_file.c:255:fopen('server-key.pem', 'w')
1204969060:error:20FFF002:BIO routines:CRYPTO_internal:system lib:bio/bss_file.c:257:

=== Generating Server signing request
Error opening Private Key server-key.pem
747847294:error:02FFF002:system library:func(4095):No such file or directory:bio/bss_file.c:255:fopen('server-key.pem', 'r')
747847294:error:20FFF002:BIO routines:CRYPTO_internal:system lib:bio/bss_file.c:257:
unable to load Private Key

=== Signing Server request
Out-File : Access to the path 'C:\extfile.cnf' is denied.
At C:\generate-certs.ps1:64 char:44
+ ... AltName = " + ($san -join ',') | Out-File extfile.cnf -Encoding Ascii
+                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : OpenError: (:) [Out-File], UnauthorizedAccessException
+ FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommand

How can I resolve this error?! What do I need to do?

I’m on windows server 2019, at aws-ec2.

Thankful!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

6reactions
m0pscommented, Aug 9, 2019

The solution can be founded here: https://github.com/PowerShell/PowerShell-Docker/issues/164#issuecomment-467566059 In brief - --user ContainerAdministrator parameter should be added to docker run command.

2reactions
Ivers07commented, Sep 11, 2019

I can confirm that --user ContainerAdministrator works. thanks @m0ps

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Access to the path is denied - Stack Overflow
You are trying to save to a file that has the same name as the directory. That cannot work, you can't overwrite a...
Read more >
Access To Path Is Denied (Permissions Error) - C# Corner
Right-click on your directory that you want to access and select "Properties". · Select the "Security" tab. · Click on the "Advanced" button....
Read more >
Access to the path is denied error - OCLC Support
Resolution. Make sure that the folder structure under C:\Users\<user>\AppData\Roaming\OCLC\ is not hidden and the user attempting to save ...
Read more >
"Access Denied" or other errors when you access or work with ...
Cause A problem that prevents you from accessing or working with files and folders can occur for one or more of the following...
Read more >
IIS Error Access to the path is denied - Get A Clue
How to fix · Login into the server · Open Windows Explorer · Verify the file is there · If it is, Right...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found