获取指定容器的最新版tag

例子: 获取 docker.io/jingjingxyk/nginx 容器的最新tag

#!/bin/bash

set -eux
__DIR__=$(cd "$(dirname "$0")";pwd)
cd ${__DIR__}

# 安装jq,解析json
test $(which jq | wc -l) -eq 0  && apt install -y jq

# 获取最新容器tag
container_latest_tag=$(curl -L -s 'https://hub.docker.com/v2/repositories/jingjingxyk/nginx/tags/?page_size=1&page=1&ordering=last_updated'|jq '."results"[]["name"]'| sed 's/\"//g')
echo $container_latest_tag

参考文档

  1. 拷贝容器镜像内的文件到容器外
  2. linux 快速安装docker
  3. 快速安装 docker-compose
  4. Dockerfile
  5. Compose file
  6. multistage-build
  7. dockerfile mount type 挂载目录
  8. dockerfiles-now-support-multiple-build-contexts
  9. 自建拉取registry.k8s.io、k8s.gcr.io、gcr.io、quay.io、ghcr.io 容器镜像的服务
  10. pdoman-desktop
  11. Docker+Wasm
posted @ 2022-10-29 12:25  jingjingxyk  阅读(17)  评论(0编辑  收藏  举报