Push a plugin to a registry
In this step, you will learn how to push a Docker plugin to a registry. Pushing a plugin allows you to share it with others or store it for later use. Before you can push a plugin, you need to have a plugin available. For demonstration purposes, we will use a simple example plugin.
First, let's pull a sample plugin image. We will use the vieux/sshfs
plugin as an example. This plugin allows you to use SSHFS for Docker volumes.
docker plugin install vieux/sshfs
You will be prompted to accept the plugin's capabilities. Type y
and press Enter.
Plugin "vieux/sshfs" is requesting the following privileges:
- network: [host]
- mount: [/dev/fuse]
- allow-devices: [fuse]
- authz: []
- capabilities: [CAP_SYS_ADMIN]
Do you grant the plugin these privileges? [y/N] y
After the plugin is installed, you can verify its installation and status using the docker plugin ls
command again.
docker plugin ls
You should now see the vieux/sshfs
plugin listed and its status should be true
(enabled).
ID NAME DESCRIPTION ENABLED
<plugin_id> vieux/sshfs Mount sshfs volumes true
Now that we have a plugin installed, we can push it to a registry. To push a plugin, you use the docker plugin push
command followed by the plugin name. For this example, we will push the vieux/sshfs
plugin.
docker plugin push vieux/sshfs
Since we are not pushing to a specific registry (like Docker Hub), this command will attempt to push to the default registry. For a real-world scenario, you would need to log in to your registry first using docker login
and specify the registry in the push command (e.g., docker plugin push your-registry.com/vieux/sshfs
).
The output will show the progress of the push operation.
The push refers to repository [docker.io/vieux/sshfs]
Pushed plugin vieux/sshfs:<tag>
This command pushes the plugin to the specified registry. If no tag is specified, the latest
tag is usually used by default.