{"record":{"id":"ff4f276cebecac5e","repo":"theonedev/onedev","slug":"this-workspace-can-only-be-provisioned-by-docker-p","errorCode":null,"errorMessage":"This workspace can only be provisioned by docker provisioner","messagePattern":"This workspace can only be provisioned by docker provisioner","errorType":"exception","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-plugin/server-plugin-provisioner-servershell/src/main/java/io/onedev/server/plugin/provisioner/servershell/ServerShellProvisioner.java","lineNumber":140,"sourceCode":"\tpublic String getApplicableProjects() {\n\t\treturn applicableProjects;\n\t}\n\n\tpublic void setApplicableProjects(String applicableProjects) {\n\t\tthis.applicableProjects = applicableProjects;\n\t}\n\t\n\t@SuppressWarnings(\"unused\")\n\tprivate static List<InputSuggestion> suggestProjects(String matchWith) {\n\t\treturn SuggestionUtils.suggestProjectPaths(matchWith);\n\t}\n\n\t@Override\n\tpublic WorkspaceRuntime provision(WorkspaceContext context, TaskLogger workspaceLogger) {\n\t\tcheckApplicable();\n\n\t\tif (context.getSpec().isRunInContainer()) \n\t\t\tthrow new ExplicitException(\"This workspace can only be provisioned by docker provisioner\");\n\n\t\tvar serverAddress = getClusterService().getLocalServerAddress();\n\t\tworkspaceLogger.log(\"Provisioning workspace on server '\" + serverAddress + \"'...\");\n\t\tpersistServerAddress(context.getWorkspaceId(), serverAddress);\t\t\n\t\t\n\t\tvar workspaceDir = getWorkspaceDir(context);\n\t\tFileUtils.createDir(workspaceDir);\n\t\tsetupRepository(context, workspaceDir.getAbsolutePath(), workspaceLogger);\n\n\t\tvar trustCertsFile = new File(workspaceDir, \"trust-certs.pem\");\n\n\t\tvar workDir = getWorkDir(context);\n\t\tvar envVars = buildEnvVars(\n\t\t\t\tcontext.getSpec().getEnvVars().stream()\n\t\t\t\t\t\t.collect(toMap(EnvVar::getName, it -> it.isSecret() ? it.getSecretValue() : it.getValue())),\n\t\t\t\tcontext.getServerUrl(), context.getToken(), \n\t\t\t\ttrustCertsFile.exists()? trustCertsFile.getAbsolutePath(): null,\n\t\t\t\tworkDir.getAbsolutePath());","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-plugin/server-plugin-provisioner-servershell/src/main/java/io/onedev/server/plugin/provisioner/servershell/ServerShellProvisioner.java#L122-L158","documentation":"ServerShellProvisioner.provision() refuses to provision a workspace whose job spec is marked runInContainer. This provisioner runs jobs directly on the server shell (no containers), so a spec requesting container execution must be handled by the docker provisioner instead. The check runs via checkApplicable()+spec inspection before any provisioning work begins.","triggerScenarios":"Calling provision() with a WorkspaceContext whose spec.isRunInContainer() returns true — i.e. the CI job/agent spec declares 'run in container' while the assigned agent uses the Server Shell provisioner.","commonSituations":"A project pipeline was written for docker-based agents but is routed to a server-shell agent pool; a spec template was copied from a docker/K8s agent setup onto a bare-server agent; the agent's provisioner was switched from docker to server shell after the spec was authored.","solutions":["Remove the 'run in container' setting from the job spec, or uncheck the container option in the pipeline/agent spec UI","Change the agent/runner handling this workspace to use the Docker provisioner instead of Server Shell","Use a different executor/pool assignment so containerized specs never land on server-shell agents"],"exampleFix":"// before (pipeline spec)\nrunInContainer: true\nimage: node:20\n// after\nrunInContainer: false\n# or assign job to a docker-provisioned agent","handlingStrategy":"validation","validationCode":"if (spec.isRunInContainer()) throw new IllegalStateException(\"Assign this job to a docker-provisioned agent or disable runInContainer\");","typeGuard":null,"tryCatchPattern":"try { provisioner.provision(ctx, logger); } catch (ExplicitException e) { logger.log(e.getMessage()); }","preventionTips":["Match the job spec's runInContainer setting with the agent's provisioner type","Audit agent pools after switching provisioner types","Use separate spec templates per provisioner kind"],"tags":["ci","provisioner","docker","config-mismatch"],"backgroundTag":"unsupported-operation","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}