首页 > 系统相关 >shell脚本列出docker所有tag

shell脚本列出docker所有tag

时间:2022-12-08 09:45:02浏览次数:43  
标签:shell tags list ----------------------------------------------------------------

docker-tags-list.sh

#!/bin/bash
# -----------------------------------------------------------------
# FileName: docker-tags-list.sh
# Date: 2021-12-24
# Author: jiftle
# Description: 
# -----------------------------------------------------------------
set -x

function usage() {
cat << HELP
dockertags  --  list all tags for a Docker image on a remote registry.
EXAMPLE:
    - list all tags for ubuntu:
       dockertags ubuntu
    - list all php tags containing apache:
       dockertags php apache
HELP
}



if [ $# -lt 1 ]; then
    usage
    exit
fi

image="$1"
tags=`wget -q https://registry.hub.docker.com/v1/repositories/${image}/tags -O -  | sed -e 's/[][]//g' -e 's/"//g' -e 's/ //g' | tr '}' '\n'  | awk -F: '{print $3}'`

if [ -n "$2" ]; then
    tags=` echo "${tags}" | grep "$2" `
fi
echo "${tags}"

标签:shell,tags,list,----------------------------------------------------------------
From: https://www.cnblogs.com/jiftle/p/16965234.html

相关文章

  • docker安装es和kibana, 解决No Living connections error 笔记
    转自:https://blog.csdn.net/weixin_43824526/article/details/1236412461.安装好docker2.安装es(elasticsearch的简写)和kibana,最好是版本一致dockerpullelasticsearch:7.......
  • shellinabox 相关资料整理
    入门资料https://www.cnblogs.com/OldJack/p/7359998.html安装因为我用CentOS所以用yumyuminstallshellinabox设置ip和端口可以设置一下服务器ip,因为我是在阿里......
  • Docker macvlan
    默认情况下docker使用bridge网络,这是一个私有网络,只能在host和container之间互通,如果发布服务,需要使用端口映射的方式来解决,比如一个nginx容器要想对外提供服务则在容器启......
  • Docker学习笔记九:Docker数据卷知识【重要】
    介绍 目的数据卷(DataVolumes)是宿主机中的一个目录或文件,数据卷的设计目的就是数据的持久化,完全独立于容器的生存周期。一个数据卷可以被多个容器同时挂载,一个容器也......
  • 快速安装docker
    本方法适用于红帽系的linux#安装yum源yum-config-manager--add-repohttps://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repoyummakecachefast#安装......
  • docker-compose的命令补全
    找文件docker-compost官方github地址https://github.com/docker/compose切换master分支点击复制在/etc/bash_completion.d/下新建docker-compose文件,保存退出后......
  • (转)【Linux】Centos7 的 Systemctl 与 创建系统服务 (shell脚本)
    原文:https://blog.csdn.net/qq_42862247/article/details/127260241Systemctlsystemctl命令#启动systemctlstartNAME.service#停止systemctlstopNAME.service#重......
  • (转)编写Shell脚本的最佳实践
    原文:https://blog.mythsman.com/post/5d2ab67ff678ba2eb3bd346f/?hmsr=toutiao.io&utm_medium=toutiao.io&utm_source=toutiao.io#--14前言由于工作需要,最近重新开始拾掇......
  • ubuntu安装docker
    sudoaptupdatesudoaptinstallapt-transport-httpsca-certificatescurlsoftware-properties-commoncurl-fsSLhttps://download.docker.com/linux/ubuntu/gpg......
  • dockerfile 缩减镜像
    title:Dockerfile缩减镜像技巧categories:-dockersummary:Dockerfile缩减镜像技巧Dockerfile缩减镜像技巧构建上下文执行dockerbuild命令时,当前的工作......