Contents

Docker搜索指定名称的容器信息

1.先上脚本

1
2
3
4
5
6
7
8
#docker-search 
#其中的json_reformat命令需要安装yajl
#!/bin/bash

repo_url=https://registry.hub.docker.com/v1/repositories
image_name=$1

curl -s ${repo_url}/${image_name}/tags | json_reformat | grep name | awk '{print $2}' | sed -e 's/"//g'

BTW:

2.Centos查询某个命令属于哪个包组

yum provides json_reformat

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
[root@rpm ~]# yum provides json_reformat
Loaded plugins: fastestmirror, langpacks
Repository epel is listed more than once in the configuration
Loading mirror speeds from cached hostfile
yajl-2.0.4-4.el7.i686 : Yet Another JSON Library (YAJL)
Repo        : os
Matched from:
Filename    : /usr/bin/json_reformat



yajl-2.0.4-4.el7.x86_64 : Yet Another JSON Library (YAJL)
Repo        : os
Matched from:
Filename    : /usr/bin/json_reformat



yajl-2.0.4-4.el7.x86_64 : Yet Another JSON Library (YAJL)
Repo        : @anaconda
Matched from:
Filename    : /usr/bin/json_reformat

3.Debian查询某个命令输入某个包组

apt search json_reformat

1
2
3
4
5
root@deb:~# apt search json_reformat
Sorting... Done
Full Text Search... Done
yajl-tools/stable 2.1.0-3 amd64
  Yet Another JSON Library - tools