The 'plugin already exists' error occurs when you try to install a Docker plugin that is already installed on your system. To resolve this, you need to disable and remove the existing plugin before reinstalling, or upgrade it if you want the latest version.
The "plugin already exists" error in Docker appears when you attempt to install a plugin using `docker plugin install` while a plugin with the same name is already registered on your system. Docker plugins extend the Docker Engine's functionality, providing capabilities like volume drivers, network drivers, authorization modules, log drivers, and more. Each plugin must have a unique identifier, and Docker prevents duplicate installations to avoid conflicts. This error is a protective mechanism that ensures you don't accidentally overwrite an existing plugin's configuration or data. Docker plugins can have associated state (like volume data for volume plugins), and blindly reinstalling could lead to data inconsistency or loss. The solution involves either removing the existing plugin and reinstalling, or using `docker plugin upgrade` if you want to update to a newer version while preserving the plugin's state.
First, verify which plugins are currently installed on your system:
# List all installed plugins
docker plugin ls
# Get more details about a specific plugin
docker plugin inspect <plugin_name>This confirms whether the plugin is actually installed and shows its current state (enabled/disabled). The output includes:
- Plugin name and tag
- Whether it's enabled
- Plugin description
Note: If the plugin shows as installed but you still want to reinstall it, proceed to the next steps.
Before you can remove a plugin, you must disable it first. Docker does not allow removal of enabled plugins:
# Disable the plugin
docker plugin disable <plugin_name>
# Example with a volume plugin
docker plugin disable vieux/sshfsIf the plugin is in use by containers or volumes, you'll need to use the force flag:
# Force disable (use with caution)
docker plugin disable -f <plugin_name>Warning: Force-disabling a plugin that's actively in use may cause containers using it to fail. Stop dependent containers first when possible.
Once disabled, remove the plugin from your system:
# Remove the plugin
docker plugin rm <plugin_name>
# Example
docker plugin rm vieux/sshfsIf removal fails because the plugin is still referenced, you can force removal:
# Force removal
docker plugin rm -f <plugin_name>Important: Even with -f, Docker will not remove an enabled plugin. You must disable it first.
After removal, verify it's gone:
docker plugin lsNow you can install the plugin fresh:
# Install the plugin
docker plugin install <plugin_name>
# Install with auto-grant permissions (useful in scripts)
docker plugin install --grant-all-permissions <plugin_name>
# Example
docker plugin install vieux/sshfsThe --grant-all-permissions flag automatically accepts the plugin's permission requirements, which is useful for automation but should be used carefully in production.
After installation, verify the plugin is enabled:
docker plugin lsIf you want to update to a newer version while preserving plugin state, use upgrade instead of reinstall:
# Disable the plugin first
docker plugin disable <plugin_name>
# Upgrade to the latest version
docker plugin upgrade <plugin_name>
# Upgrade to a specific version
docker plugin upgrade <plugin_name>:<tag>
# Re-enable the plugin
docker plugin enable <plugin_name>Note: The upgrade command preserves the plugin's configuration and any associated data (like volume driver data). This is safer than remove/reinstall when the plugin has state you want to keep.
For automation scripts where the plugin may or may not be installed, add a check before installation:
#!/bin/bash
PLUGIN_NAME="vieux/sshfs"
# Check if plugin exists
if docker plugin inspect "$PLUGIN_NAME" > /dev/null 2>&1; then
echo "Plugin $PLUGIN_NAME already installed, skipping..."
else
echo "Installing plugin $PLUGIN_NAME..."
docker plugin install --grant-all-permissions "$PLUGIN_NAME"
fiOr use a one-liner that handles both cases:
docker plugin inspect vieux/sshfs >/dev/null 2>&1 || docker plugin install --grant-all-permissions vieux/sshfsThis pattern makes your scripts idempotent - they can run multiple times without failing on the "already exists" error.
### Understanding Docker Plugin Architecture
Docker plugins are distributed as special Docker images that extend the Docker Engine. They use a well-defined API to communicate with the Docker daemon and can provide:
- Volume drivers: Custom storage backends (NFS, S3, cloud storage)
- Network drivers: Custom networking implementations
- Authorization plugins: Access control for Docker API
- Log drivers: Custom logging backends
- IPAM drivers: IP address management
Plugins are stored in /var/lib/docker/plugins/ on Linux systems.
### Plugin Aliases
When installing a plugin, you can specify an alias:
docker plugin install --alias my-sshfs vieux/sshfsThe "already exists" error can occur if:
1. The same plugin is installed with a different alias
2. A different plugin is installed with the same alias you're trying to use
Use docker plugin ls to check both plugin names and aliases.
### Cleaning Up Corrupted Plugin State
If a plugin installation was interrupted or corrupted, you may need manual cleanup:
# Stop the Docker daemon
sudo systemctl stop docker
# Find and examine plugin directories
sudo ls -la /var/lib/docker/plugins/
# Remove corrupted plugin data (get plugin ID from ls output)
sudo rm -rf /var/lib/docker/plugins/<plugin_id>
# Restart Docker
sudo systemctl start dockerWarning: Only do this if normal docker plugin rm commands fail. Manual removal bypasses Docker's safety checks.
### Plugin Permissions and Capabilities
When a plugin requests permissions, Docker shows a prompt. In CI/CD environments, use --grant-all-permissions to auto-accept:
docker plugin install --grant-all-permissions vieux/sshfsReview what permissions a plugin requires before granting:
# Check plugin permissions without installing
docker plugin install --disable vieux/sshfs
docker plugin inspect vieux/sshfs --format '{{.Settings.Env}}'### Docker Swarm Considerations
In Docker Swarm mode, plugins must be installed on each node that will use them. The "already exists" error on one node doesn't affect other nodes:
# Install on all swarm nodes (run on each node or use SSH)
docker node ls --format '{{.Hostname}}' | while read node; do
ssh "$node" 'docker plugin inspect vieux/sshfs >/dev/null 2>&1 || docker plugin install --grant-all-permissions vieux/sshfs'
done### Plugin Version Management
To check the current plugin version and available updates:
# Check installed version
docker plugin inspect <plugin_name> --format '{{.PluginReference}}'
# Pull latest version info (doesn't install)
docker plugin lsFor production systems, consider pinning plugin versions:
# Install specific version
docker plugin install vieux/sshfs:latest
# or
docker plugin install vieux/sshfs:1.0.0dockerfile parse error line 5: unknown instruction: RRUN
How to fix 'unknown instruction' Dockerfile parse error in Docker
Error response from daemon: manifest for nginx:nonexistent not found: manifest unknown: manifest unknown
How to fix 'manifest for image:tag not found' in Docker
Error response from daemon: invalid reference format: repository name must be lowercase
How to fix 'repository name must be lowercase' in Docker
Error response from daemon: No such image
How to fix 'No such image' in Docker
Error response from daemon: Container is not running
How to fix 'Container is not running' when using docker exec