查
查询当前可以下载的镜像
[root@localhost ~]# docker search httpd NAME DESCRIPTION STARS OFFICIAL AUTOMATED httpd The Apache HTTP Server Project 2781 [OK] centos/httpd-24-centos7 Platform for running Apache httpd 2.4 or bui… 27 centos/httpd 26 [OK] armhf/httpd The Apache HTTP Server Project 8 salim1983hoop/httpd24 Dockerfile running apache config 2 [OK] dariko/httpd-rproxy-ldap Apache httpd reverse proxy with LDAP authent… 1 [OK] solsson/httpd-openidc mod_auth_openidc on official httpd image, ve… 1 [OK] lead4good/httpd-fpm httpd server which connects via fcgi proxy h… 1 [OK] appertly/httpd Customized Apache HTTPD that uses a PHP-FPM … 0 [OK] dockerpinata/httpd 0 itsziget/httpd24 Extended HTTPD Docker image based on the off… 0 [OK] manasip/httpd 0 manageiq/httpd_configmap_generator Httpd Configmap Generator 0 [OK] interlutions/httpd httpd docker image with debian-based config … 0 [OK] izdock/httpd Production ready Apache HTTPD Web Server + m… 0 trollin/httpd 0 amd64/httpd The Apache HTTP Server Project 0 publici/httpd httpd:latest 0 [OK] e2eteam/httpd 0 hypoport/httpd-cgi httpd-cgi 0 [OK] manageiq/httpd Container with httpd, built on CentOS for Ma… 0 [OK] buzzardev/httpd Based on the official httpd image 0 [OK] alvistack/httpd Docker Image Packaging for Apache 0 [OK] ppc64le/httpd The Apache HTTP Server Project 0 tugboatqa/httpd The Apache HTTP Server Project 0
NAME:镜像仓库源的名称
DESCRIPTION:镜像的描述
OFFICIAL:是否docker官方发布
镜像查看
[root@localhost ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE portainer/portainer latest ff4ee4caaa23 2 weeks ago 81.6MB
REPOSITORY:表示镜像的仓库源 TAG:镜像的标签 IMAGE ID:镜像ID CREATED:镜像创建时间 SIZE:镜像大小
深入帮助
[root@localhost ~]# docker command --help
概要信息
[root@localhost ~]# docker info
列出本机的所有 image 文件。
[root@localhost ~]# docker image ls
列出本机正在运行的容器
[root@localhost ~]# docker container ls CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ad9352ac8fe4 portainer/portainer "/portainer" 3 hours ago Up 3 hours 0.0.0.0:9000->9000/tcp portainer [root@localhost ~]# docker container ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ad9352ac8fe4 portainer/portainer "/portainer" 3 hours ago Up 3 hours 0.0.0.0:9000->9000/tcp portainer
列出本机所有容器,包括终止运行的容器
[root@localhost ~]# docker container ls --all CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ad67909761d2 portainer/portainer "/portainer" 3 hours ago Created ptest ad9352ac8fe4 portainer/portainer "/portainer" 3 hours ago Up 3 hours 0.0.0.0:9000->9000/tcp portainer
容器查看,即进程查看
[root@localhost ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ad67909761d2 portainer/portainer "/portainer" 3 hours ago Created ptest ad9352ac8fe4 portainer/portainer "/portainer" 3 hours ago Up 3 hours 0.0.0.0:9000->9000/tcp portainer
查看容器输出内容
[root@localhost ~]# docker logs -f portainer(容器名称)
查询最后一次创建的容器
[root@localhost ~]# docker ps -l
查看容器内启用的线程
[root@localhost ~]# docker top portainer UID PID PPID C STIME TTY TIME CMD root 3101 3084 0 11:02 ? 00:00:04 /portainer [root@localhost ~]#
查看容器配置参数
[root@localhost ~]# docker inspect portainer
查看已创建网络环境
[root@localhost ~]# docker network ls NETWORK ID NAME DRIVER SCOPE 0ac84c0b0789 bridge bridge local 6c6cfa4d864f host host local d8bd5de31279 none null local
查看网络属性信息
[root@localhost ~]# docker network inspect portainer
查看持久化数据名称
[root@localhost ~]# docker volume ls DRIVER VOLUME NAME local 154d9903936e31e74682be4888f359506ca77393e9a89e392d86dfc7fcb2e0b9 local 1228949a934ec83c31dec34e44e070453cf14d90707556675b386146f394cb5f
查看卷标详细信息
[root@localhost ~]# docker volume inspect portainer
改
设置镜像标签,接着,为本地的 image 标注用户名和版本。
[root@localhost ~]# docker image tag ff4ee4caaa23 ljj/portainer:v1.0 [root@localhost ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE ljj/portainer v1.0 ff4ee4caaa23 2 weeks ago 81.6MB portainer/portainer latest ff4ee4caaa23 2 weeks ago 81.6MB
[root@localhost ~]# docker image tag portainer/portainer ljj/portainer:v1.1 [root@localhost ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE portainer/portainer latest ff4ee4caaa23 2 weeks ago 81.6MB ljj/portainer v1.0 ff4ee4caaa23 2 weeks ago 81.6MB ljj/portainer v1.1 ff4ee4caaa23 2 weeks ago 81.6MB
删
删除容器
[root@localhost ~]# docker rm ad67909761d2 ad67909761d2
删除 image 文件
docker image rm [imageName]
删除容器文件
[root@localhost ~]# docker container rm ad9352ac8fe4 (id或者是容器名称)
删除已创建网络
docker network rm [containerID]
删除所有未使用的网络
docker network prune -f
- # docker container run命令的--rm参数,在容器终止运行后自动删除容器文件。
- docker container run --rm -p 8000:3000 -it koa-demo /bin/bash
删除所有容器
[root@localhost ~]# docker rm -f $(docker ps -qa) ad9352ac8fe4
执行方式
执行一个镜像run 加参数 名称:镜像标签(自定义:latest)。