Uploaded image for project: 'Container Tools'
  1. Container Tools
  2. RUN-2206

[containers/podman] Multiple build context fails on Windows

XMLWordPrintable

    • Icon: Story Story
    • Resolution: Done
    • Icon: Normal Normal
    • None
    • None
    • podman
    • 3
    • False
    • None
    • False
    • rhel-sst-container-tools
    • RUN 257, RUN 258, RUN 259

      [1750144635] Upstream Reporter: leadoflife
      Upstream issue status: Open
      Upstream description:

      Issue Description

      Using the argument --build-context fails on Windows with Podman + WSL.

      > podman build --build-context a=1st .
      STEP 1/5: FROM docker.io/sonatype/nexus3:latest
      STEP 2/5: COPY --from=a . /usr/src/a/
      Error: building at STEP "COPY --from=a . /usr/src/a/": checking on sources under "/home/user/C:Usersmy_usernamesrctmppodmanmulti-ctx1st": error in copier subprocess: changing to intended-new-root directory "/home/user/C:Usersmy_usernamesrctmppodmanmulti-ctx1st": chdir /home/user/C:Usersmy_usernamesrctmppodmanmulti-ctx1st: no such file or directory

      With debug logging...

      > podman build --debug --build-context a=1st .
      time="2023-06-09T12:00:21-04:00" level=info msg="podman filtering at log level debug"
      time="2023-06-09T12:00:21-04:00" level=debug msg="Called build.PersistentPreRunE(podman build --log-level debug --build-context a=1st .)"
      time="2023-06-09T12:00:21-04:00" level=debug msg="SSH Ident Key "C:Usersmy_username.sshpodman-machine-default" SHA256:Q1wkbCLO3knjjfrzlF9jKLP/2J5ffPLSxPhNQNyYUnQ ssh-ed25519"
      time="2023-06-09T12:00:21-04:00" level=debug msg="DoRequest Method: GET URI: http://d/v4.5.0/libpod/_ping"
      time="2023-06-09T12:00:21-04:00" level=debug msg="Loading registries configuration "/etc/containers/registries.conf""
      time="2023-06-09T12:00:21-04:00" level=debug msg="Found credentials for ghcr.io in credential helper containers-auth.json in file C:Usersmy_username.configcontainersauth.json"
      time="2023-06-09T12:00:21-04:00" level=debug msg="DoRequest Method: POST URI: http://d/v4.5.0/libpod/build"
      STEP 1/2: FROM docker.io/library/hello-world:latest
      STEP 2/2: COPY --from=a . /usr/src/a/
      Error: building at STEP "COPY --from=a . /usr/src/a/": checking on sources under "/home/user/C:Usersmy_usernamesrctmppodmanmulti-ctx1st": error in copier subprocess: changing to intended-new-root directory "/home/user/C:Usersmy_usernamesrctmppodmanmulti-ctx1st": chdir /home/user/C:Usersmy_usernamesrctmppodmanmulti-ctx1st: no such file or directory
      
      time="2023-06-09T12:00:21-04:00" level=debug msg="Shutting down engines"

      Steps to reproduce the issue

      Steps to reproduce the issue

      1. On Windows (11 Pro)
      2. With Podman installed using WSL (v2)
      3. Attempt to build using the --build-context argument

      Both cmd and "Git BASH" produce errors. Using both helps rule out "pure" Linux path vs. Windows path issues.

      Describe the results you received

      Given a file and directory structure of:

      • ./Containerfile
      • ./1st/one.txt
      • ./2nd/two.txt
      • ./3rd/three.txt
      • ../subdir/sd.txt

      Single, alternative build context

      Where, "./Containerfile" contains steps for a single, alternative context build:

      FROM docker.io/library/hello-world:latest
      COPY --from=a . /usr/src/a/

      Using cmd...

      > podman build --build-context a=1st .
      STEP 1/2: FROM docker.io/library/hello-world:latest
      STEP 2/2: COPY --from=a . /usr/src/a/
      Error: building at STEP "COPY --from=a . /usr/src/a/": checking on sources under "/home/user/C:Usersmy_usernamesrctmppodmanmulti-ctx1st": error in copier subprocess: changing to intended-new-root directory "/home/user/C:Usersmy_usernamesrctmppodmanmulti-ctx1st": chdir /home/user/C:Usersmy_usernamesrctmppodmanmulti-ctx1st: no such file or directory

      Using "Git BASH"...

      $ podman build --build-context a=./1st/ .
      STEP 1/2: FROM docker.io/library/hello-world:latest
      STEP 2/2: COPY --from=a . /usr/src/a/
      Error: building at STEP "COPY --from=a . /usr/src/a/": checking on sources under "/home/user/C:Usersiserisrctmppodmanmulti-ctx1st": error in copier subprocess: changing to intended-new-root directory "/home/user/C:Usersiserisrctmppodmanmulti-ctx1st": chdir /home/user/C:Usersiserisrctmppodmanmulti-ctx1st: no such file or directory

      Multiple context build

      Where, "./Containerfile" contains steps for a multiple context build:

      FROM docker.io/library/hello-world:latest
      
      COPY --from=a . /usr/src/a/
      COPY --from=b . /usr/src/b/
      COPY --from=c . /usr/src/c/
      COPY --from=sd . /usr/src/sd/

      Using cmd...

      > podman build --build-context a=1st b=2nd c=3rd sd=..subdir .

      Using "Git BASH"...

      $ podman build --build-context a=./1st/ b=./2nd/ c=./3rd/ sd=../subdir/ .

      ... both cmd and "Git BASH" fail on the first entry, but this is included as an important use case that proves 1) multiple build contexts as well as a path up and back down through a different directory structure.

      Describe the results you expected

      Files get copied successfully from each aliased build context.

      podman info output

      host:   arch: amd64
        buildahVersion: 1.29.0
        cgroupControllers: []
        cgroupManager: cgroupfs
        cgroupVersion: v1
        conmon:     package: conmon-2.1.7-2.fc37.x86_64
          path: /usr/bin/conmon
          version: 'conmon version 2.1.7, commit: '
        cpuUtilization:     idlePercent: 99.86
          systemPercent: 0.07
          userPercent: 0.07
        cpus: 16
        databaseBackend: ""
        distribution:     distribution: fedora
          variant: container
          version: "37"
        eventLogger: journald
        hostname: LAPTOP-E4NFDVCK
        idMappings:     gidmap:     - container_id: 0
            host_id: 1000
            size: 1
          - container_id: 1
            host_id: 524288
            size: 65536
          uidmap:     - container_id: 0
            host_id: 1000
            size: 1
          - container_id: 1
            host_id: 524288
            size: 65536
        kernel: 5.15.90.1-microsoft-standard-WSL2
        linkmode: dynamic
        logDriver: journald
        memFree: 2190303232
        memTotal: 16668450816
        networkBackend: netavark
        ociRuntime:     name: crun
          package: crun-1.8.3-2.fc37.x86_64
          path: /usr/bin/crun
          version: |-
            crun version 1.8.3
            commit: 59f2beb7efb0d35611d5818fd0311883676f6f7e
            rundir: /run/user/1000/crun
            spec: 1.0.0
            +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJL
        os: linux
        remoteSocket:     exists: true
          path: /run/user/1000/podman/podman.sock
        security:     apparmorEnabled: false
          capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
          rootless: true
          seccompEnabled: true
          seccompProfilePath: /usr/share/containers/seccomp.json
          selinuxEnabled: false
        serviceIsRemote: true
        slirp4netns:     executable: /usr/bin/slirp4netns
          package: slirp4netns-1.2.0-8.fc37.x86_64
          version: |-
            slirp4netns version 1.2.0
            commit: 656041d45cfca7a4176f6b7eed9e4fe6c11e8383
            libslirp: 4.7.0
            SLIRP_CONFIG_VERSION_MAX: 4
            libseccomp: 2.5.3
        swapFree: 4294967296
        swapTotal: 4294967296
        uptime: 136h 56m 13.00s (Approximately 5.67 days)
      plugins:   authorization: null
        log:   - k8s-file
        - none
        - passthrough
        - journald
        network:   - bridge
        - macvlan
        volume:   - local
      registries:   search:   - docker.io
      store:   configFile: /home/user/.config/containers/storage.conf
        containerStore:     number: 1
          paused: 0
          running: 1
          stopped: 0
        graphDriverName: overlay
        graphOptions: {}
        graphRoot: /home/user/.local/share/containers/storage
        graphRootAllocated: 1081101176832
        graphRootUsed: 34710867968
        graphStatus:     Backing Filesystem: extfs
          Native Overlay Diff: "true"
          Supports d_type: "true"
          Using metacopy: "false"
        imageCopyTmpDir: /var/tmp
        imageStore:     number: 121
        runRoot: /run/user/1000/containers
        transientStore: false
        volumePath: /home/user/.local/share/containers/storage/volumes
      version:   APIVersion: 4.4.4
        Built: 1680521485
        BuiltTime: Mon Apr  3 07:31:25 2023
        GitCommit: ""
        GoVersion: go1.19.7
        Os: linux
        OsArch: linux/amd64
        Version: 4.4.4
      

      Podman in a container

      No

      Privileged Or Rootless

      Rootless

      Upstream Latest Release

      Yes

      Additional environment details

      Windows System

      Edition Windows 11 Pro
      Version 22H2
      Installed on    ?9/?27/?2022
      OS build    22621.1702
      Serial number   MP1WGZ82
      Experience  Windows Feature Experience Pack 1000.22641.1000.0

      System specifications

      Processor   Intel(R) Core(TM) i9-10980HK CPU @ 2.40GHz   3.10 GHz
      Installed RAM   32.0 GB (31.8 GB usable)
      System type 64-bit operating system, x64-based processor

      Additional information

      No response


      Upstream URL: https://github.com/containers/podman/issues/18840

              mloriedo Mario Loriedo
              upstream-sync Upstream Sync
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: