乐趣区

关于docker:Docker进阶

1、镜像治理命令

1、查看以后的镜像
[root@node1 wordpress]# docker images
REPOSITORY     TAG            IMAGE ID       CREATED         SIZE
nginx          v1             a80567189207   6 days ago      141MB
bjbfd/nginx    latest         605c77e624dd   17 months ago   141MB
bjbfd/nginx    v1             605c77e624dd   17 months ago   141MB
nginx          latest         605c77e624dd   17 months ago   141MB
wordpress      latest         c3c92cc3dcb1   17 months ago   616MB
mariadb        10.6.4-focal   12e05d5da3c5   19 months ago   409MB
bjbfd/stress   latest         89e5b79daa74   7 years ago     215MB

2、查看 image 命令
[root@node1 wordpress]# docker image --help

Usage:  docker image COMMAND

Manage images

Commands:
  build       Build an image from a Dockerfile
  history     Show the history of an image
  import      Import the contents from a tarball to create a filesystem image
  inspect     Display detailed information on one or more images
  load        Load an image from a tar archive or STDIN
  ls          List images
  prune       Remove unused images
  pull        Download an image from a registry
  push        Upload an image to a registry
  rm          Remove one or more images
  save        Save one or more images to a tar archive (streamed to STDOUT by default)
  tag         Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE

Run 'docker image COMMAND --help' for more information on a command.

3、下载镜像 (新增)
[root@node1 wordpress]# docker pull nginx
Using default tag: latest
latest: Pulling from library/nginx
Digest: sha256:0d17b565c37bcbd895e9d92315a05c1c3c9a29f762b011a10c54a66cd53c9b31
Status: Downloaded newer image for nginx:latest
docker.io/library/nginx:latest
阐明 : 
 nginx : 镜像名
 latest : 镜像版本

4、查看镜像列表 (列表查问)
docker images 等同 docker image ls
[root@node1 wordpress]# docker image ls
REPOSITORY     TAG            IMAGE ID       CREATED         SIZE
bjbfd/nginx    latest         605c77e624dd   17 months ago   141MB
bjbfd/nginx    v1             605c77e624dd   17 months ago   141MB
nginx          latest         605c77e624dd   17 months ago   141MB
wordpress      latest         c3c92cc3dcb1   17 months ago   616MB
mariadb        10.6.4-focal   12e05d5da3c5   19 months ago   409MB
bjbfd/stress   latest         89e5b79daa74   7 years ago     215MB
阐明 :
REPOSITORY : 示意镜像的仓库源
TAG : 镜像的标签
IMAGE ID : ID
CREATED : 镜像创立事件
SIZE : 镜像大小

5、查看镜像列表 (列表查问)

删除所有正在运行的容器
docker rm -f $(docker ps -a -q)

退出移动版