Attempt to remove the plugin using force
In the previous steps, you learned that you must disable a plugin before removing it. What happens if you try to force the removal of an enabled plugin?
The docker plugin rm
command has a --force
or -f
flag that can be used to attempt to force the removal of a plugin. However, even with the force flag, Docker will not remove an enabled plugin.
Let's first reinstall the vieux/sshfs
plugin so we have an enabled plugin to work with.
docker plugin install vieux/sshfs
Remember to type y
and press Enter when prompted to accept the capabilities.
Now that the plugin is installed and enabled again, let's try to remove it using the force flag.
docker plugin rm --force vieux/sshfs
You will see a similar error message as when you tried to remove it without the force flag, indicating that the plugin is enabled and cannot be removed.
Error response from daemon: plugin vieux/sshfs is enabled. Disable it before removing
This confirms that the force flag does not override the requirement to disable a plugin before removal. The force flag is typically used in other Docker contexts, like removing containers, images, or volumes, to bypass certain checks, but it does not apply to removing enabled plugins.
To clean up, you can disable and remove the plugin again if you wish, following the steps you learned earlier.