but it gave error
Started by user Admininsrtaor org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: WorkflowScript: 6: Invalid agent type "docker" specified. Must be one of [any, label, none] @ line 6, column 17. docker { image 'alpine:latest' } ^
That error means Jenkins isn't recognizing
agent { docker { ... } }as a valid declarative agent type.
This happens when the Docker Pipeline plugin isn’t installed/updated or you're using a syntax that your Jenkins version doesn’t support.
Correct Declarative Pipeline Example (requires Docker Pipeline Plugin):
If that still throws the same error, you’re on a Jenkins version where Docker agent must be inside
agent { docker }without nested block or plugin missing.
First verify the plugin
Dashboard → Manage Jenkins → Manage Plugins → Installed/Available
Search for:
Install & restart Jenkins if missing.
If using an older version, try simplified syntax:
If Docker agent still doesn’t work, alternative scripted solution:
Summary
Cause Fix Invalid agent type "docker". Install Docker Pipeline plugin Older Jenkins syntax Use agent { docker 'img' } or scripted pipeline Master doesn’t run jobs Must run on a node with Docker installed


