进docker 命令
时间: 2023-11-22 12:50:24 浏览: 81
以下是一些常见的Docker命令操作示例:
1. 查看Docker镜像列表:
```shell
docker images
```
2. 运行一个Docker容器:
```shell
docker run -d --name my_container image_name
```
其中,`image_name`是要运行的镜像名称。
3. 停止一个正在运行的Docker容器:
```shell
docker stop container_id
```
其中,`container_id`是要停止的容器的ID。
4. 删除一个Docker容器:
```shell
docker rm container_id
```
其中,`container_id`是要删除的容器的ID。
5. 导出一个Docker镜像为tar文件:
```shell
docker save -o image.tar image_name
```
其中,`image_name`是要导出的镜像名称。
6. 加载一个Docker镜像:
```shell
docker load -i image.tar
```
其中,`image.tar`是要加载的镜像文件。
7. 进入正在运行的容器并进行命令交互:
```shell
docker exec -it container_id bash
```
其中,`container_id`是要进入的容器的ID。
阅读全文
相关推荐









