If you need to get a PowerShell session into a running container, you have two options:
- First, you can use Enter-PSSession, as if you were connecting to another computer, except you need to give it the full ID of the container instead of the machine name. The easiest way to get there is to use a subcommand querying Docker for that container. Entering a PS session for the mycontainer container would look like this:
Enter-PSSession -containerid (docker --no-trunc -qf "name=mycontainer")
The preceding statement only works when you're running as an administrator.
- The second option is to execute the powershell command on your container and instruct Docker to open an interactive Terminal for it. This would look as follows for the mycontainer container:
docker exec -ti mycontainer powershell
With both commands...