可以通过运行一个简单的docker镜像来检测docker是否安装成功,命令是很常见的hello world,docker run hello-world
➜ ~ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
9bb5a5d4561a: Pull complete
Digest: sha256:3e1764d0f546ceac4565547df2ac4907fe46f007ea229fd7ef2718514bcec35d
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generatethis message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
➜ ~ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest e38bc07ac18e 2 months ago 1.85kB
docker container ls可以用来查看正在运行的容器,加--all参数可以看运行的历史
➜ ~ docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
➜ ~ docker container ls --all
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cbcd0f49f39d hello-world "/hello"4 minutes ago Exited(0)4 minutes ago epic_poincare
14ade628e65a hello-world "/hello"18 minutes ago Exited(0)18 minutes ago flamboyant_bell
d0a7facb8e31 hello-world "/hello"18 minutes ago Exited(0)18 minutes ago cranky_cray
docker container ls -aq,在清爽模式下查看所有的进程历史(all in quiet mode)
➜ ~ docker container ls -aq
cbcd0f49f39d
14ade628e65a
d0a7facb8e31
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步