Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

podman build with relative path to dockerfile in subdirectory fails with "no such file or directory" on Mac #12841

Closed
ConorSheehan1 opened this issue Jan 13, 2022 · 12 comments · Fixed by #12853
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. remote Problem is in podman-remote

Comments

@ConorSheehan1
Copy link

ConorSheehan1 commented Jan 13, 2022

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

Running podman build with a relative path to a Dockerfile in a subdirectory fails.
docker build works fine in this case.

Steps to reproduce the issue:

  1. Create a Dockerfile in a subdirectory
cat > ./test/Dockerfile << EOF
FROM alpine
EOF
  1. podman build -f ./test/Docker .

Describe the results you received:
Error: stat /var/tmp/libpod_builder389648463/build/test/test/Dockerfile: no such file or directory

Describe the results you expected:

successful build

podman build -f /tmp/Dockerfile .
STEP 1/1: FROM alpine
...

Additional information you deem important (e.g. issue happens only occasionally):

  1. Providing an absolute path works.
    podman build -t test -f $PWD/test/Dockerfile .

  2. Docker works fine with relative paths.
    docker build -t test -f ./test/Dockerfile .

Here's a screenshot (with successful operations killed so it fits on one screen)
Screenshot 2022-01-13 at 11 06 01

Output of podman version:

Client:
Version:      3.4.4
API Version:  3.4.4
Go Version:   go1.17.3
Built:        Wed Dec  8 18:41:11 2021
OS/Arch:      darwin/amd64

Server:
Version:      3.4.4
API Version:  3.4.4
Go Version:   go1.16.8
Built:        Wed Dec  8 21:45:07 2021
OS/Arch:      linux/amd64

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.23.1
  cgroupControllers:
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.0.30-2.fc35.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.0.30, commit: '
  cpus: 6
  distribution:
    distribution: fedora
    variant: coreos
    version: "35"
  eventLogger: journald
  hostname: localhost.localdomain
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
  kernel: 5.15.12-200.fc35.x86_64
  linkmode: dynamic
  logDriver: journald
  memFree: 7678480384
  memTotal: 8125353984
  ociRuntime:
    name: crun
    package: crun-1.4-1.fc35.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.4
      commit: 3daded072ef008ef0840e8eccb0b52a7efbd165d
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +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: true
  serviceIsRemote: true
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.1.12-2.fc35.x86_64
    version: |-
      slirp4netns version 1.1.12
      commit: 7a104a101aa3278a2152351a082a6df71f57c9a3
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.3
  swapFree: 0
  swapTotal: 0
  uptime: 23m 58.39s
plugins:
  log:
  - k8s-file
  - none
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries:
  search:
  - docker.io
store:
  configFile: /var/home/core/.config/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /var/home/core/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 0
  runRoot: /run/user/1000/containers
  volumePath: /var/home/core/.local/share/containers/storage/volumes
version:
  APIVersion: 3.4.4
  Built: 1638999907
  BuiltTime: Wed Dec  8 21:45:07 2021
  GitCommit: ""
  GoVersion: go1.16.8
  OsArch: linux/amd64
  Version: 3.4.4

Package info (e.g. output of rpm -q podman or apt list podman):

brew list --versions | grep podman
podman 3.4.4

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/master/troubleshooting.md)

Yes

Additional environment details (AWS, VirtualBox, physical, etc.):

MacOS 10.15.7 Catalina

@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label Jan 13, 2022
@mheon mheon added the remote Problem is in podman-remote label Jan 13, 2022
@baude baude added the 4.0 label Jan 13, 2022
@baude
Copy link
Member

baude commented Jan 13, 2022

@cdoern Would you have time to knock this out quick?

@cdoern
Copy link
Contributor

cdoern commented Jan 13, 2022

sure, I will take a look

cdoern added a commit to cdoern/podman that referenced this issue Jan 13, 2022
podman build always finds the abs path but was never using it for the containerfile path. This
was causing the remote client to be given a relative path that does not exist. Switch to evaluating and using absolute paths only.

resolves containers#12841

Signed-off-by: cdoern <[email protected]>
@akaci-a
Copy link

akaci-a commented Feb 4, 2022

Hello,
Before opening a new issue, is it normal that we can't use a directory for a specific context ?
podman build -f /tmp/Dockerfile folder
instead of
podman build -f /tmp/Dockerfile .
?
Kind regards

@rhatdan
Copy link
Member

rhatdan commented Feb 4, 2022

No that should be allowed.

@akaci-a
Copy link

akaci-a commented Feb 4, 2022

Hello @rhatdan,

With a simple dockerfile like that :

FROM golang:1.15-alpine AS builder
COPY root.crt /etc/ssl/certs/root.crt
RUN cat /etc/ssl/certs/root.crt >> /etc/ssl/certs/ca-certificates.crt
RUN apk --no-cache add ca-certificates \
  && update-ca-certificates

With the command :

podman build --platform="linux/amd64" -f Dockerfile dependencies
I want my root.crt to be in the dependencies folder (with many other files) but i got this error :

Error: stat /var/tmp/libpod_builder142412274/build/Users/XXXXXX/Dockerfile: no such file or directory

If it's not normal I can open a new issue.

Thanks in advance :)

@rhatdan
Copy link
Member

rhatdan commented Feb 4, 2022

What version of Podman? I think this is fixed in podman 4.0. This is remote podman (podman on a Mac).

@rhatdan
Copy link
Member

rhatdan commented Feb 4, 2022

Which you almost certainly do not have yet. RC3 was released today, but you need it on the server as well as the client.

@akaci-a
Copy link

akaci-a commented Feb 4, 2022

@rhatdan

podman version
Client:
Version:      3.4.4
API Version:  3.4.4
Go Version:   go1.17.3
Built:        Wed Dec  8 19:41:11 2021
OS/Arch:      darwin/arm64

Server:
Version:      3.4.4
API Version:  3.4.4
Go Version:   go1.16.8
Built:        Wed Dec  8 22:48:10 2021
OS/Arch:      linux/arm64

Only on local mode with a Maxbook air M1

@rhatdan
Copy link
Member

rhatdan commented Feb 4, 2022

Yup have to wait for next release.

@akaci-a
Copy link

akaci-a commented Feb 4, 2022

Thanks :) Do you have any release date ?

@rhatdan
Copy link
Member

rhatdan commented Feb 4, 2022

Some time in the next few weeks.

@Chris2011
Copy link

Hello @rhatdan,

With a simple dockerfile like that :

FROM golang:1.15-alpine AS builder
COPY root.crt /etc/ssl/certs/root.crt
RUN cat /etc/ssl/certs/root.crt >> /etc/ssl/certs/ca-certificates.crt
RUN apk --no-cache add ca-certificates \
  && update-ca-certificates

With the command :

podman build --platform="linux/amd64" -f Dockerfile dependencies I want my root.crt to be in the dependencies folder (with many other files) but i got this error :

Error: stat /var/tmp/libpod_builder142412274/build/Users/XXXXXX/Dockerfile: no such file or directory

If it's not normal I can open a new issue.

Thanks in advance :)

This is the exact same problem that I have on my windows 11 Devkit ARM machine and I have the latest podman version 4.4.4 I can provide more info here or should I create a new ticket?

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Aug 27, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. remote Problem is in podman-remote
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants