日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Docker Review - docker images 常用命令

發布時間:2025/3/21 编程问答 46 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Docker Review - docker images 常用命令 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

文章目錄

  • docker help
  • docker image相關的命令
    • docker images 查看所有本地的主機上的鏡像
    • docker search 搜索鏡像
    • docker pull 下載鏡像
    • docker rmi 刪除鏡像
    • 其他....


docker help

[root@VM-0-7-centos ~]# docker helpUsage: docker [OPTIONS] COMMANDA self-sufficient runtime for containersOptions:--config string Location of client config files (default "/root/.docker")-c, --context string Name of the context to use to connect to the daemon (overrides DOCKER_HOST env var and default contextset with "docker context use")-D, --debug Enable debug mode-H, --host list Daemon socket(s) to connect to-l, --log-level string Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")--tls Use TLS; implied by --tlsverify--tlscacert string Trust certs signed only by this CA (default "/root/.docker/ca.pem")--tlscert string Path to TLS certificate file (default "/root/.docker/cert.pem")--tlskey string Path to TLS key file (default "/root/.docker/key.pem")--tlsverify Use TLS and verify the remote-v, --version Print version information and quitManagement Commands:app* Docker App (Docker Inc., v0.9.1-beta3)builder Manage buildsbuildx* Build with BuildKit (Docker Inc., v0.6.1-docker)config Manage Docker configscontainer Manage containerscontext Manage contextsimage Manage imagesmanifest Manage Docker image manifests and manifest listsnetwork Manage networksnode Manage Swarm nodesplugin Manage pluginsscan* Docker Scan (Docker Inc., v0.8.0)secret Manage Docker secretsservice Manage servicesstack Manage Docker stacksswarm Manage Swarmsystem Manage Dockertrust Manage trust on Docker imagesvolume Manage volumesCommands:attach Attach local standard input, output, and error streams to a running containerbuild Build an image from a Dockerfilecommit Create a new image from a container's changescp Copy files/folders between a container and the local filesystemcreate Create a new containerdiff Inspect changes to files or directories on a container's filesystemevents Get real time events from the serverexec Run a command in a running containerexport Export a container's filesystem as a tar archivehistory Show the history of an imageimages List imagesimport Import the contents from a tarball to create a filesystem imageinfo Display system-wide informationinspect Return low-level information on Docker objectskill Kill one or more running containersload Load an image from a tar archive or STDINlogin Log in to a Docker registrylogout Log out from a Docker registrylogs Fetch the logs of a containerpause Pause all processes within one or more containersport List port mappings or a specific mapping for the containerps List containerspull Pull an image or a repository from a registrypush Push an image or a repository to a registryrename Rename a containerrestart Restart one or more containersrm Remove one or more containersrmi Remove one or more imagesrun Run a command in a new containersave Save one or more images to a tar archive (streamed to STDOUT by default)search Search the Docker Hub for imagesstart Start one or more stopped containersstats Display a live stream of container(s) resource usage statisticsstop Stop one or more running containerstag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGEtop Display the running processes of a containerunpause Unpause all processes within one or more containersupdate Update configuration of one or more containersversion Show the Docker version informationwait Block until one or more containers stop, then print their exit codesRun 'docker COMMAND --help' for more information on a command.To get more help with docker, check out our guides at https://docs.docker.com/go/guides/ [root@VM-0-7-centos ~]#

來看看幾個和幫助相關的命令

# 顯示docker版本信息 [root@VM-0-7-centos ~]# docker version # 顯示docker系統信息,包括鏡像和容器數量 [root@VM-0-7-centos ~]# docker info # 幫助信息 [root@VM-0-7-centos ~]# docker COMMAND --help Run 'docker COMMAND --help' for more information on a command.

文檔: https://docs.docker.com/engine/reference/commandline/docker/


docker image相關的命令

文檔: https://docs.docker.com/engine/reference/commandline/image/

docker images 查看所有本地的主機上的鏡像

https://docs.docker.com/engine/reference/commandline/images/

【使用】

docker images [OPTIONS] [REPOSITORY[:TAG]]

【demo】

[root@VM-0-7-centos ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE hello-world latest feb5d9fea6a5 12 days ago 13.3kB # 解釋 REPOSITORY 鏡像的倉庫源 TAG 鏡像的標簽 IMAGE ID 鏡像的id CREATED 鏡像的創建時間 SIZE 鏡像的大小


docker search 搜索鏡像

[root@VM-0-7-centos ~]# docker search tomcat NAME DESCRIPTION STARS OFFICIAL AUTOMATED tomcat Apache Tomcat is an open source implementati… 3146 [OK] tomee Apache TomEE is an all-Apache Java EE certif… 93 [OK] dordoka/tomcat Ubuntu 14.04, Oracle JDK 8 and Tomcat 8 base… 58 [OK] kubeguide/tomcat-app Tomcat image for Chapter 1 31 consol/tomcat-7.0 Tomcat 7.0.57, 8080, "admin/admin" 18 [OK] cloudesire/tomcat Tomcat server, 6/7/8 15 [OK] aallam/tomcat-mysql Debian, Oracle JDK, Tomcat & MySQL 13 [OK] arm32v7/tomcat Apache Tomcat is an open source implementati… 11 andreptb/tomcat Debian Jessie based image with Apache Tomcat… 10 [OK] rightctrl/tomcat CentOS , Oracle Java, tomcat application ssl… 7 [OK] arm64v8/tomcat Apache Tomcat is an open source implementati… 6 unidata/tomcat-docker Security-hardened Tomcat Docker container. 5 [OK] amd64/tomcat Apache Tomcat is an open source implementati… 3 oobsri/tomcat8 Testing CI Jobs with different names. 2 cfje/tomcat-resource Tomcat Concourse Resource 2 jelastic/tomcat An image of the Tomcat Java application serv… 2 fabric8/tomcat-8 Fabric8 Tomcat 8 Image 2 [OK] picoded/tomcat7 tomcat7 with jre8 and MANAGER_USER / MANAGER… 1 [OK] 99taxis/tomcat7 Tomcat7 1 [OK] chenyufeng/tomcat-centos tomcat基于centos6的鏡像 1 [OK] ppc64le/tomcat Apache Tomcat is an open source implementati… 1 camptocamp/tomcat-logback Docker image for tomcat with logback integra… 1 [OK] s390x/tomcat Apache Tomcat is an open source implementati… 0 softwareplant/tomcat Tomcat images for jira-cloud testing 0 [OK] secoresearch/tomcat-varnish Tomcat and Varnish 5.0 0 [OK] [root@VM-0-7-centos ~]# # 可選項,通過鏡像來過濾-f, --filter=STARS=3000 # 搜索出來的鏡像就是STARS大于3000的 [root@VM-0-7-centos ~]# docker search tomcat --filter=STARS=3000 NAME DESCRIPTION STARS OFFICIAL AUTOMATED tomcat Apache Tomcat is an open source implementati… 3146 [OK] [root@VM-0-7-centos ~]#


docker pull 下載鏡像

[root@VM-0-7-centos ~]# docker search mysql NAME DESCRIPTION STARS OFFICIAL AUTOMATED mysql MySQL is a widely used, open-source relation… 11507 [OK] mariadb MariaDB Server is a high performing open sou… 4367 [OK] mysql/mysql-server Optimized MySQL Server Docker images. Create… 850 [OK] percona Percona Server is a fork of the MySQL relati… 557 [OK] phpmyadmin phpMyAdmin - A web interface for MySQL and M… 336 [OK] centos/mysql-57-centos7 MySQL 5.7 SQL database server 91 mysql/mysql-cluster Experimental MySQL Cluster Docker images. Cr… 88 centurylink/mysql Image containing mysql. Optimized to be link… 59 [OK] databack/mysql-backup Back up mysql databases to... anywhere! 51 prom/mysqld-exporter 42 [OK] deitch/mysql-backup REPLACED! Please use http://hub.docker.com/r… 41 [OK] tutum/mysql Base docker image to run a MySQL database se… 35 linuxserver/mysql A Mysql container, brought to you by LinuxSe… 31 schickling/mysql-backup-s3 Backup MySQL to S3 (supports periodic backup… 31 [OK] mysql/mysql-router MySQL Router provides transparent routing be… 23 centos/mysql-56-centos7 MySQL 5.6 SQL database server 20 arey/mysql-client Run a MySQL client from a docker container 18 [OK] fradelg/mysql-cron-backup MySQL/MariaDB database backup using cron tas… 16 [OK] yloeffler/mysql-backup This image runs mysqldump to backup data usi… 7 [OK] openshift/mysql-55-centos7 DEPRECATED: A Centos7 based MySQL v5.5 image… 6 devilbox/mysql Retagged MySQL, MariaDB and PerconaDB offici… 3 jelastic/mysql An image of the MySQL database server mainta… 2 ansibleplaybookbundle/mysql-apb An APB which deploys RHSCL MySQL 2 [OK] widdpim/mysql-client Dockerized MySQL Client (5.7) including Curl… 1 [OK] centos/mysql-80-centos7 MySQL 8.0 SQL database server 1# 下載一個mysql的鏡像,默認下載最新的鏡像[root@VM-0-7-centos ~]# docker pull mysql Using default tag: latest latest: Pulling from library/mysql 07aded7c29c6: Pull complete f68b8cbd22de: Pull complete 30c1754a28c4: Pull complete 1b7cb4d6fe05: Pull complete 79a41dc56b9a: Pull complete 00a75e3842fb: Pull complete b36a6919c217: Pull complete 635b0b84d686: Pull complete 6d24c7242d02: Pull complete 5be6c5edf16f: Pull complete cb35eac1242c: Pull complete a573d4e1c407: Pull complete Digest: sha256:4fcf5df6c46c80db19675a5c067e737c1bc8b0e78e94e816a778ae2c6577213d Status: Downloaded newer image for mysql:latest docker.io/library/mysql:latest [root@VM-0-7-centos ~]# [root@VM-0-7-centos ~]# [root@VM-0-7-centos ~]# [root@VM-0-7-centos ~]## 下載指定版本的鏡像[root@VM-0-7-centos ~]# docker pull mysql:5.7 5.7: Pulling from library/mysql 07aded7c29c6: Already exists f68b8cbd22de: Already exists 30c1754a28c4: Already exists 1b7cb4d6fe05: Already exists 79a41dc56b9a: Already exists 00a75e3842fb: Already exists b36a6919c217: Already exists 5e11fe494f45: Pull complete 9c7de1f889a7: Pull complete cf6a13d05a76: Pull complete fc5aa81f393a: Pull complete Digest: sha256:360c7488c2b5d112804a74cd272d1070d264eef4812d9a9cc6b8ed68c3546189 Status: Downloaded newer image for mysql:5.7 docker.io/library/mysql:5.7 [root@VM-0-7-centos ~]# [root@VM-0-7-centos ~]## 查看下載的所有鏡像[root@VM-0-7-centos ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE mysql 5.7 9f35042c6a98 8 days ago 448MB mysql latest 2fe463762680 8 days ago 514MB hello-world latest feb5d9fea6a5 12 days ago 13.3kB [root@VM-0-7-centos ~]#


docker rmi 刪除鏡像

[root@VM-0-7-centos ~]# docker rmi 9f35042c6a98 Untagged: mysql:5.7 Untagged: mysql@sha256:360c7488c2b5d112804a74cd272d1070d264eef4812d9a9cc6b8ed68c3546189 Deleted: sha256:9f35042c6a98363147ae456147643a3d14c484640f13f4ab207cf2c296839baf Deleted: sha256:69a5732b5b989ff688326db6354b0f50165a71cfe7579b285054b561fb3c5143 Deleted: sha256:448b1f9cb8f126363f0e809e0e450c493ca1e725715127a258c5346fcae7cd8a Deleted: sha256:4064542818b4bf92f293da870d3ea1413a20d0c1a83f72917c50986880255338 Deleted: sha256:8ca7f5e08bac7aa39cf9b8b79bf40669373b9aed45ec76eb0fa55109350b6672 [root@VM-0-7-centos ~]# [root@VM-0-7-centos ~]# [root@VM-0-7-centos ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE mysql latest 2fe463762680 8 days ago 514MB hello-world latest feb5d9fea6a5 12 days ago 13.3kB [root@VM-0-7-centos ~]#

【批量操作】

## 刪除所有鏡像 [root@VM-0-7-centos ~]# docker rmi -f $(docker images -aq) [root@VM-0-7-centos ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE [root@VM-0-7-centos ~]## # 刪除多個鏡像 [root@VM-0-7-centos ~]# docker rmi -f 鏡像id 鏡像id 鏡像id [root@VM-0-7-centos ~]# docker rmi -f $(docker images -aq) Untagged: mysql:latest Untagged: mysql@sha256:4fcf5df6c46c80db19675a5c067e737c1bc8b0e78e94e816a778ae2c6577213d Deleted: sha256:2fe4637626805dc6df98d3dc17fa9b5035802dcbd3832ead172e3145cd7c07c2 Deleted: sha256:e00bdaa10222919253848d65585d53278a2f494ce8c6a445e5af0ebfe239b3b5 Deleted: sha256:83411745a5928b2a3c2b6510363218fb390329f824e04bab13573e7a752afd50 Deleted: sha256:e8e521a71a92aad623b250b0a192a22d54ad8bbeb943f7111026041dce20d94f Deleted: sha256:024ee0ef78b28663bc07df401ae3a258ae012bd5f37c2960cf638ab4bc04fafd Deleted: sha256:597139ec344c8cb622127618ae21345b96dd23e36b5d04b071a3fd92d207a2c0 Deleted: sha256:28909b85bd680fc47702edb647a06183ae5f3e3020f44ec0d125bf75936aa923 Deleted: sha256:4e007ef1e2a3e1e0ffb7c0ad8c9ea86d3d3064e360eaa16e7c8e10f514f68339 Deleted: sha256:b01d7bbbd5c0e2e5ae10de108aba7cd2d059bdd890814931f6192c97fc8aa984 Deleted: sha256:d98a368fc2299bfa2c34cc634fa9ca34bf1d035e0cca02e8c9f0a07700f18103 Deleted: sha256:95968d83b58ae5eec87e4c9027baa628d0e24e4acebea5d0f35eb1b957dd4672 Deleted: sha256:425adb901baf7d6686271d2ce9d42b8ca67e53cffa1bc05622fd0226ae40e9d8 Deleted: sha256:476baebdfbf7a68c50e979971fcd47d799d1b194bcf1f03c1c979e9262bcd364 Untagged: hello-world:latest Untagged: hello-world@sha256:9ade9cc2e26189a19c2e8854b9c8f1e14829b51c55a630ee675a5a9540ef6ccf Deleted: sha256:feb5d9fea6a5e9606aa995e879d862b825965ba48de054caab5ef356dc6b3412 [root@VM-0-7-centos ~]# [root@VM-0-7-centos ~]# [root@VM-0-7-centos ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE [root@VM-0-7-centos ~]#


其他…

https://docs.docker.com/engine/reference/commandline/images/

總結

以上是生活随笔為你收集整理的Docker Review - docker images 常用命令的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。