Docker常用命令

本文详细介绍了Docker的常用命令,包括搜索、下载、列出、删除和构建镜像,以及新建、启动、停止、重启和管理容器等操作。重点讲解了Dockerfile构建镜像及容器的网络模式、端口映射和日志查看等关键步骤。
摘要由CSDN通过智能技术生成

镜像相关命令

搜索镜像

$ docker search --limit 1 --filter=stars=10 hello-world
NAME			DESCRIPTION     STARS    OFFICIAL	AUTOMATED
hello-world		Hello World!    1154     [OK]

下载镜像

$ docker pull hello-world
Using default tag: latest
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:f9dfddf63636d84ef479d645ab5885156ae030f611a56f3a7ac7f2fdd86d7e4e
Status: Downloaded newer image for hello-world:latest
docker.io/library/hello-world:latest

列出镜像

$ docker images hello*
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              fce289e99eb9        14 months ago       1.84kB

删除镜像

$ docker rmi hello-world
Untagged: hello-world:latest
Untagged: hello-world@sha256:f9dfddf63636d84ef479d645ab5885156ae030f611a56f3a7ac7f2fdd86d7e4e
Deleted: sha256:fce289e99eb9bca977dae136fbe2a82b6b7d4c372474c9235adc1741675f587e
Deleted: sha256:af0b15c8625bb1938f1d7b17081031f649fd14e6b233688eea3c5483994a66a3

$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE

保存镜像

$ docker save hello-world > hello-world.tar

加载镜像

$ docker load < hello-world.tar
af0b15c8625b: Loading layer [==================================================>] 3.584kB/3.584kB
L
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值