docker 容器 命令行_从命令行使用Docker容器

docker 容器 命令行

The Docker Desktop application is awesome to work with containers locally via a graphical interface.

Docker Desktop应用程序很棒,可以通过图形界面在本地使用容器。

You are not required to use it. You can use the CLI commands.

您不需要使用它。 您可以使用CLI命令。

The docker ps command lists the currently running containers:

docker ps命令列出了当前正在运行的容器:

This is the same as running docker container ls.

这与运行docker container ls相同。

In this case, container with name node-app and ID 739037a911e0 generated from the image examplenode, created 4 minutes ago, is up since 4 minutes, and the port 80 of the host machine is mapped to the container port 3000 using the TCP protocol.

在这种情况下,用名容器node-app和ID 739037a911e0从图像生成examplenode ,在4 minutes ago ,是向上自4分钟,和主机的端口80使用TCP协议映射到容器端口3000。

When you know the contained ID, you can stop the container by running

当您知道所包含的ID时,可以通过运行来停止容器

docker container stop <ID>

Once a container is stopped, you can see it using docker container ls -a:

容器停止后,您可以使用docker container ls -a看到它:

And you can remove it using docker container rm:

您可以使用docker container rm删除它:

docker container rm <ID>

You can inspect all the details about a container running docker inspect:

您可以检查有关运行docker inspect的容器的所有详细信息:

Another useful CLI command is docker info which gives you lots of information about the current state of your Docker installation, including the number of containers and images.

另一个有用的CLI命令是docker info ,它为您提供有关Docker安装当前状态的大量信息,包括容器和映像的数量。

翻译自: https://flaviocopes.com/docker-containers-command-line/

docker 容器 命令行

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值