• Stars
    star
    131
  • Rank 275,867 (Top 6 %)
  • Language
    Shell
  • License
    MIT License
  • Created over 5 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🐳 Docker Client Plugins Manager - build new plugins, publish them on Docker Hub or just try some plugins from the catalog and install them locally

lukaszlach / clip

Version

Docker Client Plugins Manager (CLIP) is a Docker client plugin allowing to create, build new Docker client plugins in any programming language, publish them on Docker Hub or just try some plugins from the catalog and install them locally. Project is written entirely in Bash.

Plugins are distributed as Docker images and can be published on Docker Hub, they are built from "scratch" so the image size reflects the plugin binary size. Example plugins from this repository are written in Bash so the plugin images are tiny (500 bytes - 2 KB).

Start with downloading the CLIP Docker plugin:

curl -sf https://raw.githubusercontent.com/lukaszlach/clip/master/docker-clip -o ~/.docker/cli-plugins/docker-clip
chmod +x ~/.docker/cli-plugins/docker-clip

It should be automatically detected by the Docker client:

$ docker info | grep clip
  clip: Docker Client Plugins Manager (Łukasz Lach, v19.06.0)

$ docker clip --help

There are a lot of ready plugins available in this repository and already published on Docker Hub. Search through the remote plugin catalog using docker clip search command.

You can install them with a single docker clip add command. If you do not like one of the plugins you can remove it using the docker clip rm command.

Install the plugin

docker clip add IMAGE:TAG

As CLIP distributes plugins as Docker images - all you need to know is the image name and tag. Call docker clip add to install any plugin locally, the image will be pulled from the registry if needed.

$ docker clip add lukaszlach/clips:expose
Installing client plugin from lukaszlach/clips:expose
Successfully installed lukaszlach/clips:expose client plugin
New client command available: 'docker expose'

$ docker expose --help

Remove the plugin

docker clip rm COMMAND

You can uninstall the plugin with the docker clip rm command:

$ docker clip rm expose
Successfully removed 'expose' client command

List plugins

docker clip ls

The command lists all additional Docker client plugins installed and maintained by CLIP:

$ docker clip ls
COMMAND      IMAGE
microscan    lukaszlach/clips:microscan

Search for plugin

docker clip search [PATTERN]

Search the remote plugin catalog:

$ docker clip search security
COMMAND         IMAGE                           DESCRIPTION
microscan       lukaszlach/clips:microscan      Scan the security of an image with Aqua Microscanner

Specifying a pattern is optional, the command will list all plugins if it is not passed:

$ docker clip search
COMMAND         IMAGE                           DESCRIPTION
dive            lukaszlach/clips:dive           Explore contents of the image layers
expose          lukaszlach/clips:expose         Expose container HTTP port on the Internet
hello           lukaszlach/clips:hello          Hello World
...

Build new plugin

docker clip build -c COMMAND -t IMAGE:TAG CONTEXT
docker clip push IMAGE:TAG

In order to build a new plugin you need to create a build context directory which must contain two files. Assuming you are developing the hello command (see the example implementation in this repository):

  • docker-hello - the plugin executable, can be a binary or a shell script
  • docker-hello.json - the plugin manifest in JSON format

The manifest file is used by Docker Client to fetch details about the plugin and to ensure it is supported.

  • SchemaVersion needs to be set to 0.1.0
  • Vendor, Version and ShortDescription can take any string value, they are visible in the output of docker and docker info commands
{
  "SchemaVersion": "0.1.0",
  "Vendor": "Łukasz Lach",
  "Version": "v1.0",
  "ShortDescription": "Hello World"
}

The script stored in docker-hello can be as simple as:

#!/bin/sh
echo Hello World

Any other files present in the build context directory will be added along with the binary and manifest, your plugin can use and depend on these files to be present on the client disk after installation.

After you are ready with the plugin code, build the plugin image with the docker clip build command:

$ docker clip build -c hello -t lukaszlach/clips:hello .
Building lukaszlach/clips:hello client plugin
sha256:8d53da12e07fe6d0ae9f129311de985361718f6903583113082042f96ca95be3
Successfully built lukaszlach/clips:hello client plugin

Pass the command name in -c parameter and an image tag in -t, the last parameter is a build context. The command works similarly to docker build and actually uses it underneath to build the image.

You can now test the plugin locally by simply installing it or push it to the registry with the docker clip push command:

$ docker clip push lukaszlach/clips:hello

Contributors

Licence

MIT License

Copyright (c) 2019 Łukasz Lach [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

docker-tc

🐳 🚦 Docker Traffic Control - network rate limiting, emulating delays, losses, duplicates, corrupts and reorders of network packets using only container labels or a command-line interface.
Shell
661
star
2

commando

🐳 Container registry which provides you all the commands you need in a lightweight Alpine image. DevOps and SysOps best friend. https://command-not-found.com
Shell
534
star
3

kali-desktop

🐳 Kali Linux desktop running in Docker on any operating system, in your web browser or a VNC client, with Kali top10 tools pre-installed.
Makefile
126
star
4

satis-server

🐳 Private, self-hosted Composer/Satis repository with unlimited private and open-source packages and support for Git, Mercurial, and Subversion. HTTP API, HTTPs support, webhook handler, scheduled builds, Slack and HipChat integration.
Shell
113
star
5

orca

🐳 Orca | Docker workshop
Go
32
star
6

consul-conf

🐳 Consul.conf provides responsive web interface for managing configuration of your services in Consul key-value storage through beautiful and customizable dashboards, distributed as a lightweight Docker image.
PHP
32
star
7

code-container

🐳 Microsoft Visual Studio Code running in a Docker container, accessible through a web browser and aimed for Docker development.
Shell
27
star
8

magento-docker

🐳 Bootstrap Magento 1.9 / 2.1 installation in Docker with fully integrated Kibana, Grafana, Portainer, cAdvisor, Prometheus, MailCatcher and more
VCL
22
star
9

docker-file

🐳 Parse and validate Dockerfile, docker-compose.yml, .env and .dockerignore files and return their contents in JSON format for further analysis.
Go
19
star
10

docker-movie

🐳 Docker Movie converts a movie file (avi, mp4, mpg, mkv, etc.) into a "playable" Docker image
Shell
6
star
11

gitlab-docker-playground

🐳 Playground for running GitLab and GitLab Runner in Docker
Makefile
3
star
12

libvmod-shell

🐚 Varnish Module (VMOD) for executing long-running shell commands with support of two-way communication and command interface based on one-line request and one-line response, allows you to use any programming language or sh scripting and expose it's features to VCL.
C
3
star
13

varnish-docker-playground

Playground for learning basics of Varnish 6, all set up in Docker with upstreams on PHP 7.2.
VCL
2
star
14

selenium-docker-playground

Selenium Hub and Nodes (Chrome, Firefox) in Docker + Node.js / Jasmine test running in Docker on this stack
JavaScript
2
star
15

lukaszlach

1
star
16

orca-gitlab

🐳 Orca | Docker workshop
Makefile
1
star
17

uw-docker

PHP
1
star