noamanelson@noamanelson-Virtual-Machine:~$ docker pull ubuntu:18.0418.04: Pulling from library/ubuntu
0c5227665c11: Pull complete
Digest: sha256:8aa9c2798215f99544d1ce7439ea9c3a6dfd82de607da1cec3a8a2fae005931b
Status: Downloaded newer image for ubuntu:18.04
docker.io/library/ubuntu:18.04
noamanelson@noamanelson-Virtual-Machine:~$
运行镜像,比如启动 bash 并且进行交互式操作:
docker run -it --rm ubuntu:18.04 bash
noamanelson@noamanelson-Virtual-Machine:~$ docker run -it --rm ubuntu:18.04 bash
root@36e7bfa463f2:/#
root@36e7bfa463f2:/#
root@36e7bfa463f2:/# lsbin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
root@36e7bfa463f2:/#
1.3 docker run说明
参数说明,可以使用docker run --help查看:
noamanelson@noamanelson-Virtual-Machine:~$ docker run --help
Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
Create and run a new container from an image
Aliases:
docker container run, docker run
Options:
--add-host list Add a custom host-to-IP mapping (host:ip)
-a, --attach list Attach to STDIN, STDOUT or STDERR
--blkio-weight uint16 Block IO (relative weight), between 10and1000, or0 to disable (default 0)
--blkio-weight-device list Block IO weight (relative device weight) (default [])
--cap-add list Add Linux capabilities
--cap-drop list Drop Linux capabilities
--cgroup-parent string Optional parent cgroup for the container
--cgroupns string Cgroup namespace to use (host|private)
......
noamanelson@noamanelson-Virtual-Machine:~$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu 18.04 3941d3b032a8 2 months ago 63.1MB
hello-world latest feb5d9fea6a5 19 months ago 13.3kB
noamanelson@noamanelson-Virtual-Machine:~$
参数说明:
参数
说明
REPOSITORY
仓库名
TAG
标签
IMAGE ID
镜像ID
CREATED
创建时间
SIZE
占用空间
2.2 镜像空间
这里的占用空间和Docker Hub 上看到的镜像大小不同;
下载的镜像是是展开后的各层所占空间的总和,Docker Hub 是压缩后的体积;
docker system df查看镜像、容器、数据卷所占用的空间:
noamanelson@noamanelson-Virtual-Machine:~$ docker system df
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 2163.16MB 63.15MB (99%)
Containers 10 0B 0B
Local Volumes 00 0B 0B
Build Cache 00 0B 0B
noamanelson@noamanelson-Virtual-Machine:~$
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧