# dockertools **Repository Path**: rocrunning/dockertools ## Basic Information - **Project Name**: dockertools - **Description**: docker 工具包 - **Primary Language**: Go - **License**: GPL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-07-12 - **Last Updated**: 2022-11-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README DockerTools 工具用于教学使用,0.1 版本使用 flag 传递环境变量,0.2 版本中使用 cobra 重构,并增加了镜像标签查询功能 # 下载使用 - 目前仅提供 Linux\Windows 平台版本的工具,如果需要其它平台可以自行编译 ## gitee 官方下载 [![j7PL4J.png](https://s1.ax1x.com/2022/07/19/j7PL4J.png)](https://imgtu.com/i/j7PL4J) [![j7Pvg1.png](https://s1.ax1x.com/2022/07/19/j7Pvg1.png)](https://imgtu.com/i/j7Pvg1) ## cloudmessage.top 下载 ### Linux 平台 ```shell wget https://cloudmessage.top/upload/2022/11/dockertools-de953437c3e74d978bd0562605633a72. ``` ### windows 平台 ```cmd https://cloudmessage.top/upload/2022/11/dockertools-5a23e3d5761c405e82243484e144f173.exe ``` # 使用方法 ## 一、连接 dockertools 方式 ### 第一种:本地连接 将 dockertools 上传至对应的 Docker 服务器端直接使用命令即可 ```shell [root@localhost dockertools]# ./dockertools save -r "wangyanglinux/myapp:v[1-3]" -s "images" has dir![images] [wangyanglinux/myapp:v1 wangyanglinux/myapp:v3 wangyanglinux/myapp:v2] 输入匹配的镜像列表是否满足要求:(Y/N) y 文件已成功保存! images/wangyanglinux-myapp-v1.tar 文件已成功保存! images/wangyanglinux-myapp-v3.tar 文件已成功保存! images/wangyanglinux-myapp-v2.tar ``` ### 第二种:进行远程连接(通过网络将远程的 DockerServer 中的功能进行使用) #### 1、开启 DockerServer 的远程连接, 通过选项 -h 192.168.66.11:2375 指定远程 DockerServer 端口,开启 DockerServer 远程连接的方法为修改 ```shell /usr/lib/systemd/system/docker.service 文件中的 ExecStart=/usr/bin/dockerd -H tcp://192.168.66.11:2375 -H fd:// --containerd=/run/containerd/containerd.sock ``` #### 2、远程执行命令 ```powershell dockertools.exe save -a 192.168.66.11:2375 -r "wangyanglinux/myapp:v[1-3]" -s "./image" ``` [![j7FwOP.png](https://s1.ax1x.com/2022/07/19/j7FwOP.png)](https://imgtu.com/i/j7FwOP) ## 二、功能讲解 ### 第一种:通过正则表达式匹配镜像,保存至指定目录 ```shell $ ./dockertools save -a 192.168.66.11:2375 -r "wangyanglinux/myapp:v[1-3]" -s "./image" $ ./dockertools save -r "wangyanglinux/myapp:v[1-3]" -s "images" $ ./dockertools save -h # 查看帮助信息 ``` [![j7FO61.png](https://s1.ax1x.com/2022/07/19/j7FO61.png)](https://imgtu.com/i/j7FO61) ### 第二种:指定目录镜像镜像导入,支持单文件以及目录 ```shell $ ./dockertools load -l "./images" -a "192.168.66.11:2375" $ ./dockertools load -l "./images" $ ./dockertools load -h ``` [![j7kY7T.png](https://s1.ax1x.com/2022/07/19/j7kY7T.png)](https://imgtu.com/i/j7kY7T) ### 第三种:查询镜像拥有的可用标签信息 ```shell [root@localhost dockertools]# ./dockertools searchtag -i mysql -n 20 -t "5" TAG SIZE(MB) LASTPUSH 8.0.25 154 2021-06-23T07:31:50Z 5.7.38-oracle 121 2022-07-13T07:04:55Z 5.7.38-debian 154 2022-07-12T02:09:36Z 5.7.38 121 2022-07-13T07:04:53Z 5.7.37-oracle 119 2022-03-31T02:30:07Z 5.7.37-debian 148 2022-04-20T10:23:20Z 5.7.37 148 2022-04-20T10:23:18Z 5.7.36 147 2021-12-21T03:15:51Z 5.7.35 147 2021-10-12T16:42:35Z 5.7.34 147 2021-06-23T07:31:34Z 5.7.33 147 2021-04-10T07:42:35Z 5.7.32 147 2021-01-12T10:33:14Z 5.7-oracle 121 2022-07-13T07:04:51Z 5.7-debian 154 2022-07-12T02:09:28Z 5.7 121 2022-07-13T07:04:48Z 5.6.51 98 2021-12-21T03:15:45Z 5.6 98 2021-12-21T03:15:44Z 5-oracle 121 2022-07-13T07:04:45Z 5-debian 154 2022-07-12T02:09:20Z 5 121 2022-07-13T07:04:42Z ``` - -i:指定要搜索的仓库名,即传统意义上的镜像名 - -n:指定检索便签的数量大小 - -t:指定要匹配的便签名称必须包含此关键字 # 欢迎大家访问我的个人博客,https://cloudmessage.top/ 持续更新云计算相关内容 ![img](https://z3.ax1x.com/2021/11/04/ImrFDf.png)