Docker Desktop v3.0 已於前兩週正式發佈,從這個版本起,Docker 官方承諾每次的更新將以增量更新的方式來提供,以便減小下載包的體積,提高效率。git
除了將 Docker Engine 更新至 v20.10.0 外,也對其餘的依賴作了更新,以下圖:github
最吸引個人是本次新增的 Docker Hub Tool v0.2.0 ,它是 Docker 官方提供的 Docker Hub CLI 工具,具有管理 DockerHub 上的賬號,鏡像等相關資源的能力。docker
如下,我來爲你介紹下 Hub Tool 的主要功能。json
(MoeLove) ➜ hub-tool -h A tool to manage your Docker Hub images Usage: hub-tool hub-tool [command] Available Commands: account Manage your account help Help about any command login Login to the Hub logout Logout of the Hub org Manage organizations repo Manage repositories tag Manage tags token Manage Personal Access Tokens version Version information about this tool Flags: -h, --help help for hub-tool --verbose Print logs --version Display the version of this tool Use "hub-tool [command] --help" for more information about a command.
從一級菜單來看,主要功能包括:工具
當前我使用的是最新版本 v0.2.0 。ui
(MoeLove) ➜ hub-tool version Version: v0.2.0 Git commit: 0edf43ac9091e7cac892cbc4cbc6efbafb665aa4
登陸/退出只要執行 hub-tool login
或者 hub-tool logout
便可。this
但這裏須要注意的是 Hub Tool 並無使用 Docker Desktop 默認的用戶憑證,也就是說,即便你在 Docker Desktop 中已經登陸了賬號,你一樣仍是須要再次在終端下執行 login 操做。spa
關於爲什麼沒有共用用戶憑證的問題,我跟 Docker Inc. 的產品經理聊過,是由於當前 Hub Tool 仍是一個獨立的 CLI 工具,並無與 docker CLI 進行集成,也暫時沒想好要如何集成。等真正要集成進 docker CLI 的時候,就會直接共用用戶憑證了。code
(MoeLove) ➜ hub-tool login Username: moelove Password:
帳戶管理的兩個功能:orm
(MoeLove) ➜ hub-tool account Manage your account Usage: hub-tool account hub-tool account [command] Available Commands: info Print the account information rate-limiting Print the rate limiting information Flags: -h, --help help for account Global Flags: --verbose Print logs Use "hub-tool account [command] --help" for more information about a command. (MoeLove) ➜ hub-tool account rate-limiting Limit: 200, 6 hours window Remaining: 200, 6 hours window (MoeLove) ➜ hub-tool account info Username: moelove.info Full name: Jintao Zhang Company: Location: Joined: 6 years ago Plan: free Limits: Seats: 1 Private repositories: 1 Parallel builds: 1 Collaborators: unlimited Teams: unlimited
能夠看到,hub-tool org
的功能就是展現一些相關信息了。
(MoeLove) ➜ hub-tool org Manage organizations Usage: hub-tool org hub-tool org [command] Available Commands: ls List all the organizations members List all the members in an organization teams List all the teams in an organization Flags: -h, --help help for org Global Flags: --verbose Print logs Use "hub-tool org [command] --help" for more information about a command. (MoeLove) ➜ hub-tool org ls NAMESPACE NAME MY ROLE TEAMS MEMBERS
因爲這兩個都和鏡像有直接的關係,我就聚合到一塊兒介紹了。
(MoeLove) ➜ hub-tool repo -h Manage repositories Usage: hub-tool repo hub-tool repo [command] Available Commands: ls List all the repositories from your account or an organization rm Delete a repository Flags: -h, --help help for repo Global Flags: --verbose Print logs Use "hub-tool repo [command] --help" for more information about a command. (MoeLove) ➜ hub-tool repo ls REPOSITORY DESCRIPTION LAST UPDATE PULLS STARS PRIVATE taobeier/saythx-work 2 years ago 56989 0 false ... (MoeLove) ➜ hub-tool repo ls -h List all the repositories from your account or an organization Usage: hub-tool repo ls [ORGANIZATION] Aliases: ls, list Flags: --all Fetch all available repositories --format string Print values using a custom format ("json") -h, --help help for ls Global Flags: --verbose Print logs
(MoeLove) ➜ hub-tool tag Manage tags Usage: hub-tool tag [flags] hub-tool tag [command] Available Commands: inspect Show the details of an image in the registry ls List all the images in a repository rm Delete a tag in a repository Flags: -h, --help help for tag Global Flags: --verbose Print logs Use "hub-tool tag [command] --help" for more information about a command. See 'hub-tool tag ls --help'. Usage: hub-tool tag ls [OPTION] REPOSITORY List all the images in a repository (MoeLove) ➜ hub-tool tag ls taobeier/saythx-work TAG DIGEST STATUS LAST UPDATE LAST PUSHED LAST PULLED SIZE taobeier/saythx-work:latest sha256:3133a607d062dd3a8b46f38c8271099c258f5e59cecd652bebddf6e15789cb32 active 2 years ago 2 years 6 days 52.94MB taobeier/saythx-work:1.0 sha256:3133a607d062dd3a8b46f38c8271099c258f5e59cecd652bebddf6e15789cb32 active 2 years ago 2 years 6 days 52.94MB
對我的 Token 的建立/刪除,激活/失效,列表,查詢詳細等功能。
(MoeLove) ➜ hub-tool token -h Manage Personal Access Tokens Usage: hub-tool token [flags] hub-tool token [command] Available Commands: activate Activate a Personal Access Token create Create a Personal Access Token deactivate Deactivate a Personal Access Token inspect Inspect a Personal Access Token ls List all the Personal Access Tokens rm Delete a Personal Access Token Flags: -h, --help help for token Global Flags: --verbose Print logs Use "hub-tool token [command] --help" for more information about a command. (MoeLove) ➜ hub-tool token ls DESCRIPTION UUID LAST USED CREATED ACTIVE test-docker-token xxxxxxxx-xxxx-xxxx-xxxx-moelove.info 9 months ago 9 months true (MoeLove) ➜ hub-tool token inspect xxxxxxxx-xxxx-xxxx-xxxx-moelove.info Token: UUID: xxxxxxxx-xxxx-xxxx-xxxx-moelove.info Description: test-docker-token Is Active: true Created: 9 months ago Last Used: 9 months ago Creator User Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.4103.116 Safari/537.36 Creator IP: 100.000.000.00 Generated: By user via Web UI
以上就是關於 Docker 新發布的 Hub Tool 的所有功能介紹了。
當前它是隨着 Docker Desktop 一塊兒發行的,因此 Linux 下暫時沒有。可是計劃會盡快開源。敬請期待!
歡迎訂閱個人文章公衆號【MoeLove】