jenkinsci / docker-plugin

Jenkins cloud plugin that uses Docker
https://plugins.jenkins.io/docker-plugin/
MIT License
490 stars 318 forks source link

Attach Docker container fails on Windows - filesystem operations not supported #876

Closed CJCombrink closed 2 years ago

CJCombrink commented 2 years ago

Jenkins and plugins versions report

Environment ```text Jenkins: 2.332 OS: Linux - 5.4.119-1-pve --- ace-editor:1.1 analysis-model-api:10.9.1 ant:1.13 antisamy-markup-formatter:2.7 apache-httpcomponents-client-4-api:4.5.13-1.0 artifactory:3.15.4 authentication-tokens:1.4 bitbucket:214.v2fd4234d0554 blueocean:1.25.2 blueocean-autofavorite:1.2.4 blueocean-bitbucket-pipeline:1.25.2 blueocean-commons:1.25.2 blueocean-config:1.25.2 blueocean-core-js:1.25.2 blueocean-dashboard:1.25.2 blueocean-display-url:2.4.1 blueocean-events:1.25.2 blueocean-git-pipeline:1.25.2 blueocean-github-pipeline:1.25.2 blueocean-i18n:1.25.2 blueocean-jwt:1.25.2 blueocean-personalization:1.25.2 blueocean-pipeline-api-impl:1.25.2 blueocean-pipeline-editor:1.25.2 blueocean-pipeline-scm-api:1.25.2 blueocean-rest:1.25.2 blueocean-rest-impl:1.25.2 blueocean-web:1.25.2 bootstrap4-api:4.6.0-3 bootstrap5-api:5.1.3-4 bouncycastle-api:2.25 branch-api:2.7.0 build-monitor-plugin:1.13+build.202201311821 build-pipeline-plugin:1.5.8 build-timeout:1.20 caffeine-api:2.9.2-29.v717aac953ff3 checks-api:1.7.2 cloudbees-bitbucket-branch-source:751.vda_24678a_f781 cloudbees-folder:6.17 cmakebuilder:4.1.1 cobertura:1.17 code-coverage-api:2.0.4 command-launcher:1.6 conditional-buildstep:1.4.1 config-file-provider:3.9.0 configuration-as-code:1346.ve8cfa_3473c94 copyartifact:1.46.2 cppcheck:1.25 credentials:1074.v60e6c29b_b_44b_ credentials-binding:1.27.1 data-tables-api:1.11.3-6 display-url-api:2.3.5 docker-commons:1.19 docker-java-api:3.1.5.2 docker-plugin:1.2.6 docker-workflow:1.28 dtkit-api:3.0.0 durable-task:493.v195aefbb0ff2 echarts-api:5.2.2-2 email-ext:2.87 embeddable-build-status:2.0.3 envfile:1.2 envinject:2.4.0 envinject-api:1.8 external-monitor-job:191.v363d0d1efdf8 favorite:2.3.3 flaky-test-handler:1.2.0 font-awesome-api:5.15.4-5 forensics-api:1.7.0 git:4.10.3 git-client:3.11.0 git-server:1.10 github:1.34.1 github-api:1.301-378.v9807bd746da5 github-branch-source:2.11.4 golang:1.4 gradle:1.38 h2-api:1.4.199 handlebars:3.0.8 handy-uri-templates-2-api:2.1.8-1.0 htmlpublisher:1.29 ivy:2.1 jackson2-api:2.13.1-246.va8a9f3eaf46a javadoc:1.6 javax-activation-api:1.2.0-2 javax-mail-api:1.6.2-5 jaxb:2.3.0.1 jdk-tool:1.5 jenkins-design-language:1.25.2 jjwt-api:0.11.2-9.c8b45b8bb173 jnr-posix-api:3.1.7-1 jquery:1.12.4-1 jquery-detached:1.2.1 jquery3-api:3.6.0-2 jsch:0.1.55.2 junit:1.55 junit-realtime-test-reporter:82.vc2a_3f0f7a_291 ldap:2.7 lockable-resources:2.14 log-parser:2.2 m2release:0.16.2 mailer:408.vd726a_1130320 mapdb-api:1.0.9.0 matrix-auth:3.0.1 matrix-project:1.20 maven-plugin:3.16 mercurial:2.16 momentjs:1.1.1 nodejs:1.5.1 nodelabelparameter:1.10.3 okhttp-api:4.9.3-105.vb96869f8ac3a pam-auth:1.7 parameterized-trigger:2.43 parasoft-findings:10.5.2 performance:3.20 pipeline-build-step:2.15 pipeline-github-lib:36.v4c01db_ca_ed16 pipeline-graph-analysis:188.v3a01e7973f2c pipeline-input-step:446.vf27b_0b_83500e pipeline-maven:3.10.0 pipeline-milestone-step:1.3.2 pipeline-model-api:2.2064.v5eef7d0982b_e pipeline-model-definition:2.2064.v5eef7d0982b_e pipeline-model-extensions:2.2064.v5eef7d0982b_e pipeline-rest-api:2.21 pipeline-stage-step:291.vf0a8a7aeeb50 pipeline-stage-tags-metadata:2.2064.v5eef7d0982b_e pipeline-stage-view:2.21 pipeline-utility-steps:2.12.0 plain-credentials:1.8 plugin-util-api:2.13.0 popper-api:1.16.1-2 popper2-api:2.11.2-1 prism-api:1.25.0-2 promoted-builds:3.11 promoted-builds-simple:1.9 publish-over:0.22 publish-over-ssh:1.22 pubsub-light:1.16 pvs-studio:7.17 report-info:1.1 repository-connector:2.2.0 resource-disposer:0.17 run-condition:1.5 scm-api:595.vd5a_df5eb_0e39 script-security:1131.v8b_b_5eda_c328e snakeyaml-api:1.29.1 sse-gateway:1.25 ssh-agent:1.24.1 ssh-credentials:1.19 ssh-slaves:1.33.0 sshd:3.1.0 stashNotifier:1.25 structs:308.v852b473a2b8c subversion:2.15.2 swarm:3.30 testInProgress:1.4 testng-plugin:554.va4a552116332 thinBackup:1.10 timestamper:1.17 token-macro:267.vcdaea6462991 trilead-api:1.0.13 ui-samples-plugin:2.0 valgrind:0.28 variant:1.4 warnings-ng:9.11.0 windows-slaves:1.8 workflow-aggregator:2.6 workflow-api:1136.v7f5f1759dc16 workflow-basic-steps:2.24 workflow-cps:2648.va9433432b33c workflow-cps-global-lib:552.vd9cc05b8a2e1 workflow-durable-task-step:1121.va_65b_d2701486 workflow-job:1167.v8fe861b_09ef9 workflow-multibranch:706.vd43c65dec013 workflow-scm-step:2.13 workflow-step-api:622.vb_8e7c15b_c95a_ workflow-support:813.vb_d7c3d2984a_0 ws-cleanup:0.40 xunit:3.0.5 ```

What Operating System are you using (both controller, and any agents involved in the problem)?

Controller - Unix Docker Host - Windows 10 20H2 (19042.1415) Docker Server Version: 20.10.12 Docker Image base: mcr.microsoft.com/dotnet/framework/sdk:latest

Reproduction steps

  1. Added "Docker" cloud in Jenkins
  2. Pointed to Docker
  3. Added "Docker Agent Template"
  4. Configure template to use Connect method: Attach Docker Container
  5. Run my pipeline pointing to the new agent template.

Expected Results

Docker container started and Jenkins attaches to the container.

Actual Results

The "Enable" option in the cloud configuration for the Agent Template shows the following error:

Note: Disabled 4.7 sec ago due to error. Will re-enable in 4 min 55 sec.
Reason: Template provisioning failed.
com.github.dockerjava.api.exception.InternalServerErrorException: {"message":"filesystem operations against a running Hyper-V container are not supported"} at com.github.dockerjava.netty.handler.HttpResponseHandler.channelRead0(HttpResponseHandler.java:109)   at com.github.dockerjava.netty.handler.HttpResponseHandler.channelRead0(HttpResponseHandler.java:33)    at 
...

Anything else?

I have tried the "Connect with SSH" option but run into the same issue #745 with Could not find the file /root in container

stephan48 commented 2 years ago

Hi,

I had the same problems and made a PR with possible fixes - https://github.com/jenkinsci/docker-plugin/pull/872

I am still waiting for Feedback, because as mentionend in there I am not a 100% Happy.

Kind Regards, Stephan

pjdarton commented 2 years ago

I've implemented the uber-simple fix that I proposed above and merged that into the codebase so that'll be in the next official release of the docker-plugin. You'll find a pre-release at https://ci.jenkins.io/job/Plugins/job/docker-plugin/job/master/ where you can download the .hpi file and then upload it to your Jenkins instance using manage plugins -> advanced.

Please let me know (by commenting here) if that fixes the issue. If it doesn't fix the issue, please re-open this and/or let me know (by commenting here).