Jenkins is working with plugins, if you didn’t install Docker and Docker Pipeline plugins you can get this error. “Jenkins. Invalid agent type “docker” specified. Must be one of [any, label, none]”. You can fix this error with following steps;
Go to the
- Dashboard -> Manage Jenkins -> Manage Plugins -> Available tab
- Select Docker and Docker Pipeline from the list

- Then click Install, after restart, plugins should be available.
It is better to have docker installed also on your worker nodes.
Here you can find a sample declarative style pipeline to test your Jenkins.
pipeline { agent { docker { image 'maven:3.3.3' } } stages { stage('build') { steps { sh 'mvn --version' } } } }