简体   繁体   English

如何以交互方式启动之前停止的 docker Powershell 容器

[英]How to start a docker Powershell container interactively which was stopped before

I need to try out some stuff with Powershell on Linux.我需要在 Linux 上使用 Powershell 尝试一些东西。 I have created a docker container with the following command:我使用以下命令创建了一个 docker 容器:

docker run -it --name pwsh mcr.microsoft.com/powershell:lts-centos-8

This works as expected and i have an interactive shell i can work with.这按预期工作,我有一个可以使用的交互式 shell。 But i want to reuse it after i have stopped the container.但是我想在停止容器后重新使用它。

I have tried the following:我尝试了以下方法:

docker start -ia pswh

But this just starts the container and immediately stops it.但这只是启动容器并立即停止它。 Any Ideas how i can again enter an interactive session?我有什么想法可以再次进入交互式会话吗?

虽然我没有针对我自己的问题的解决方案,但我已经制定了解决方法并使用了包含 powershell 的 .NET SDK 容器映像。

您可以通过在交互模式下执行以下命令来启动容器:

docker -it pswh /bin/bash

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM