Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Add Powershell script to set network category to private for DockerNAT. #1019

Merged
merged 2 commits into from Apr 29, 2019

Conversation

gababu
Copy link
Contributor

@gababu gababu commented Apr 28, 2019

Adding powershell script to set DockerNAT network category to private which solves the problem referred in #295 and proposal from dotnet/docs#11528.

This can be a workaround to run this script until docker figures out a better way to solve the issue.
The setting is required to be done at restart, however, setting this as scheduled task to run this script might help. (I can update the documentation too once this is accepted and merged)

Copy link
Collaborator

@mvelosop mvelosop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @gababu, thanks for the PR!

This works fine, just a minor request to avoid the frustration of the permissions error message! 😉

cli-windows/set-dockernat-networkategory-to-private.ps1 Outdated Show resolved Hide resolved
@mvelosop
Copy link
Collaborator

cc/ @CyrexCore2k

Updateded to Show Message to run as administrator. 

When run without elevated below message would be shown. Which is clear to run as administrator

.\set-dockernat-networkategory-to-private.ps1 : The script 'set-dockernat-networkategory-to-private.ps1' cannot be run
because it contains a "#requires" statement for running as Administrator. The current Windows PowerShell session is
not running as Administrator. Start Windows PowerShell by  using the Run as Administrator option, and then try running
the script again.
At line:1 char:1
+ .\set-dockernat-networkategory-to-private.ps1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : PermissionDenied: (set-dockernat-n...-to-private.ps1:String) [], ScriptRequiresException
    + FullyQualifiedErrorId : ScriptRequiresElevation
@mvelosop
Copy link
Collaborator

Thanks @gababu!

Merging now 😊

@mvelosop mvelosop merged commit 097d3b2 into dotnet-architecture:dev Apr 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants