#验证 sudo docker run hello-world [root@dockerhost ~]# docker version
1 2 3 4
#查看下载镜像 [root@dockerhost ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE hello-world latest feb5d9fea6a5 6 months ago 13.3kB
常用命令
帮助命令
1 2 3
docker version #版本 docker --help #帮助 docker info #显示docker详细信息
镜像命令
docker images 查看本地镜像
1 2 3 4 5 6 7 8 9 10 11 12 13 14
[root@dockerhost ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE hello-world latest feb5d9fea6a5 6 months ago 13.3kB
# 解释 REPOSLORY 镜像的仓库源 TAG 镜像的标等 IMAGE ID 镜像id CREATED 创建时间 SIZE 大小
# 可选项 -a,--all #列出所有镜像 -q,--quiet #列出镜像id
docker search 查找
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
[root@dockerhost ~]# docker search busybox NAME DESCRIPTION STARS OFFICIAL AUTOMATED busybox Busybox base image. 2569 [OK] radial/busyboxplus Full-chain, Internet enabled, busybox made f… 48 [OK]
#可选项 Usage: docker search [OPTIONS] TERM
Search the Docker Hub for images
Options: -f, --filter filter Filter output based on conditions provided --format string Pretty-print search using a Go template --limit int Max number of search results (default 25) --no-trunc Don't truncate output
#创建容器并启动 [root@dockerhost ~]# docker run --name docker-cent -it centos /bin/bash [root@90841170aaad /]# ls bin dev etc home lib lib64 lost+found media mnt opt proc root run sbin srv sys tmp usr var
#参数: --details Show extra details provided to logs -f, --follow Follow log output --since string Show logs since timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes) -n, --tail string Number of lines to show from the end of the logs (default "all") -t, --timestamps Show timestamps --until string Show logs before a timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes)
查看进程id
1
docker top 容器id
查看元数据
1 2 3 4 5 6
docker inspect [OPTIONS] NAME|ID [NAME|ID...]
Options: -f, --format string Format the output using the given Go template -s, --size Display total file sizes if the type is container --type string Return JSON for specified type