Lösungen
Märkte
Referenzen
Services
Unternehmen
Access a Container through Enter-PSSession

Access a Container through Enter-PSSession

28. März 2017

Access a Container through Enter-PSSession

If you’ve worked with Windows Containers, you’ll probably know this, but I have to admit that I didn’t and it really helps to work conveniently with Windows Containers, especially reading and editing files: You can access a Container with Enter-PSSession.

It works like this and I learned it from artisticcheese’s GitHub repo: First, install the necessary PowerShell modules by doing

Register-PSRepository -Name DockerPS-Dev -SourceLocation https://ci.appveyor.com/nuget/docker-powershell-dev
Install-Module Docker -Repository DockerPS-Dev

After that you can easily access your Container through Enter-PSSession like this

Enter-PSSession -ContainerId (Get-Container navsqlcompose_nav_1).ID -RunAsAdministrator

This is a big deal – at least to me – because I can now very conveniently edit files through PSEdit. E.g. if I want to change the config for Microsoft.Dynamics.Nav.Server.exe.config it is as simple as this inside PowerShell ISE:

Enter-PSSession -ContainerId (Get-Container navsqlcompose_nav_1).ID -RunAsAdministrator
PSEdit 'C:\Program Files\Microsoft Dynamics NAV\100\Service\Microsoft.Dynamics.Nav.Server.exe.config'

2 Kommentare zu “Access a Container through Enter-PSSession”

    1. Yes, I think that one was deprecated in the meantime. I personally don’t use it anymore and for the scenario described in this blog post, I do

      Enter-PSSession -ContainerId (docker ps --no-trunc -qf "name=navsqlcompose_nav_1").ID -RunAsAdministrator

      A bit more typing to do, but one dependency less


Schreibe einen Kommentar