The 'plugin is in use' error occurs when Docker prevents you from disabling or removing a plugin because volumes, networks, or other resources still reference it. Remove the dependent resources first, or use the force flag to override.
The "plugin is in use" error in Docker appears when you try to disable or remove a Docker plugin (such as a volume driver or network plugin) while Docker resources still depend on it. Docker plugins extend the Docker Engine's functionality. Common plugins include volume drivers (like `rexray/s3fs`, `vieux/sshfs`, `loki` logging driver) and network drivers. When you create volumes or networks using a plugin, Docker maintains a reference to that plugin. Even after you stop all containers using plugin-managed resources, the plugin cannot be disabled or removed until those resources (volumes, networks) are explicitly deleted. In Docker Swarm mode, this becomes more complex because resources may exist across multiple nodes in the cluster, making the plugin appear "in use" even when no local containers reference it. This is a safety mechanism to prevent accidentally breaking containers or losing data by removing plugins that are still needed.
First, identify what resources are keeping the plugin in use:
# List all volumes and check their drivers
docker volume ls
# Find volumes using a specific driver (plugin)
docker volume ls --filter driver=PLUGIN_NAME
# List networks and their drivers
docker network ls
# Inspect the plugin to see references
docker plugin inspect PLUGIN_NAMEReplace PLUGIN_NAME with your plugin name (e.g., vieux/sshfs, rexray/s3fs, loki).
Common volume driver plugins include:
- rexray/s3fs - Amazon S3 storage
- vieux/sshfs - SSH file system
- grafana/loki-docker-driver - Loki logging
Delete any volumes created by the plugin:
# List volumes using the plugin driver
docker volume ls --filter driver=PLUGIN_NAME
# Remove a specific volume
docker volume rm VOLUME_NAME
# Remove multiple volumes at once
docker volume rm volume1 volume2 volume3
# Remove ALL volumes using a specific driver (use with caution)
docker volume ls --filter driver=PLUGIN_NAME -q | xargs docker volume rmImportant: If a volume contains important data, back it up first:
# Create a temporary container to copy data
docker run --rm -v VOLUME_NAME:/source -v $(pwd):/backup alpine \
tar czf /backup/volume-backup.tar.gz -C /source .If you get "volume is in use" errors, find and remove dependent containers first:
docker ps -a --filter volume=VOLUME_NAME
docker rm $(docker ps -a -q --filter volume=VOLUME_NAME)If the plugin is a network driver, remove dependent networks:
# List networks
docker network ls
# Inspect a network to see its driver
docker network inspect NETWORK_NAME | grep Driver
# Remove the network
docker network rm NETWORK_NAMENote: You cannot remove networks with connected containers. Disconnect or remove containers first:
# Disconnect a container from a network
docker network disconnect NETWORK_NAME CONTAINER_NAME
# Or stop and remove the container
docker stop CONTAINER_NAME && docker rm CONTAINER_NAMEOnce resources are removed (or if you're certain no critical resources depend on the plugin), use the force flag:
# Disable the plugin with force
docker plugin disable -f PLUGIN_NAME
# Then remove the plugin
docker plugin rm PLUGIN_NAMEThe -f (or --force) flag tells Docker to disable the plugin even if it detects references. Use this cautiously as it may affect running containers.
Important: You cannot remove an enabled plugin. Always disable first, then remove:
docker plugin disable PLUGIN_NAME
docker plugin rm PLUGIN_NAMEOr combine with force flags:
docker plugin disable -f PLUGIN_NAME && docker plugin rm PLUGIN_NAMEIf the plugin still shows as "in use" after removing all resources, a Docker daemon restart may clear stale references:
# Linux (systemd)
sudo systemctl restart docker
# Linux (service command)
sudo service docker restart
# macOS / Windows
# Restart Docker Desktop from the system tray/menu barAfter restart, try disabling and removing the plugin again:
docker plugin disable PLUGIN_NAME
docker plugin rm PLUGIN_NAMEThis works because Docker rebuilds its internal state on startup, clearing any stale references that may have persisted in memory.
In Docker Swarm mode, volumes may exist across multiple nodes, causing the "in use" error even when no local resources reference the plugin.
Option 1: Remove resources from all nodes
# SSH to each node and remove volumes
ssh node1 "docker volume ls --filter driver=PLUGIN_NAME -q | xargs docker volume rm"
ssh node2 "docker volume ls --filter driver=PLUGIN_NAME -q | xargs docker volume rm"Option 2: Leave the swarm temporarily
# Leave the swarm (manager nodes need --force)
docker swarm leave --force
# Now disable and remove the plugin
docker plugin disable -f PLUGIN_NAME
docker plugin rm PLUGIN_NAME
# Rejoin the swarm
docker swarm join --token <TOKEN> <MANAGER-IP>:2377Option 3: Remove swarm services using the plugin
# List services
docker service ls
# Remove services using the plugin's volumes
docker service rm SERVICE_NAME### Understanding Docker Plugin Architecture
Docker plugins run as separate processes managed by the Docker daemon. They communicate with Docker via a well-defined API. When you install a plugin, Docker:
1. Pulls the plugin image from a registry
2. Creates a plugin rootfs and config
3. Starts the plugin process
4. Registers the plugin's capabilities (volume driver, network driver, etc.)
The "in use" error occurs because Docker tracks references between plugins and the resources they manage. This tracking happens at the daemon level, not per-container.
### Plugin Types and Their Resources
| Plugin Type | Creates | Common Examples |
|-------------|---------|-----------------|
| Volume Driver | Volumes | rexray/s3fs, vieux/sshfs, convoy |
| Network Driver | Networks | weave, calico, overlay |
| Log Driver | Log configs | loki, splunk, fluentd |
| Authorization | Auth policies | casbin, opa |
### Plugin State Management
Plugins have three key states:
- Installed: Plugin files exist but not running
- Enabled: Plugin is running and available for use
- In Use: Resources depend on the plugin
You can only remove a plugin that is:
1. Disabled (not enabled)
2. Not in use (no resources reference it)
### Troubleshooting Persistent "In Use" Errors
If the plugin remains "in use" after removing all visible resources:
# Check Docker's internal plugin state
cat /var/lib/docker/plugins/*/config.json | jq '.
# List plugin rootfs
ls -la /var/lib/docker/plugins/
# Check for orphaned references in Docker's state
# (Requires Docker to be stopped)
sudo systemctl stop docker
sudo cat /var/lib/docker/network/files/local-kv.db | strings | grep PLUGIN_NAME### Force Removal as Last Resort
If all else fails, you can manually remove plugin data (Linux only):
# Stop Docker
sudo systemctl stop docker
# Find the plugin ID
PLUGIN_ID=$(docker plugin ls --filter reference=PLUGIN_NAME -q)
# Remove plugin directory
sudo rm -rf /var/lib/docker/plugins/$PLUGIN_ID
# Start Docker
sudo systemctl start dockerWarning: This bypasses Docker's safety checks and may leave orphaned resources.
### Preventing Future Issues
To avoid "plugin in use" errors:
1. Use named volumes explicitly: Track which volumes use which plugins
2. Document plugin dependencies: In your docker-compose.yml or README
3. Clean up before uninstalling: Always remove resources before plugins
4. Use `docker system prune`: Regularly clean up unused resources
# Clean up unused volumes (including plugin-managed)
docker volume prune
# Full system cleanup
docker system prune --volumes### Logging Plugins (Special Case)
Logging plugins like Loki or Splunk can be tricky because the reference is at the daemon level, not per-volume:
# Check if the logging plugin is set as default
docker info | grep "Logging Driver"
# Containers may reference the plugin in their config
docker inspect CONTAINER | grep LogConfigTo remove a logging plugin:
1. Stop all containers using that log driver
2. Change containers to use a different log driver
3. Then disable and remove the plugin
image operating system "linux" cannot be used on this platform
How to fix 'image operating system linux cannot be used on this platform' in Docker
manifest unknown: manifest unknown
How to fix 'manifest unknown' in Docker
cannot open '/etc/passwd': Permission denied
How to fix 'cannot open: Permission denied' in Docker
Error response from daemon: failed to create the ipvlan port
How to fix 'failed to create the ipvlan port' in Docker
toomanyrequests: Rate exceeded for anonymous users
How to fix 'Rate exceeded for anonymous users' in Docker Hub