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 play kube does not seem to respect WORKDIR set in Dockerfile #5174

Closed
gfokkema opened this issue Feb 11, 2020 · 5 comments
Closed

podman play kube does not seem to respect WORKDIR set in Dockerfile #5174

gfokkema opened this issue Feb 11, 2020 · 5 comments
Assignees
Labels
Good First Issue This issue would be a good issue for a first time contributor to undertake. 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.

Comments

@gfokkema
Copy link

gfokkema commented Feb 11, 2020

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

/kind bug

Description

podman play kube does not seem to respect WORKDIR set in Dockerfile

Steps to reproduce the issue:

  1. Take this demo.Dockerfile as example container:
ROM alpine:latest
WORKDIR /bin
CMD ["pwd"]

Build using: buildah bud -t localhost/demo:1.0 -f demo.Dockerfile

  1. Running with podman run gives:
┌─gerlof-laptop ~/docker/demo #
└─╼podman run --name demo_run localhost/demo:1.0
/bin
  1. Take this demo.yaml as example kube pod:
apiVersion: v1
kind: Pod
metadata:
  name: demo_pod
spec:
  containers:
  - image: localhost/demo:1.0
    name: demo_kube
  1. Running with podman play kube gives:
┌─gerlof-laptop ~/docker/demo #
└─╼podman play kube demo.yaml 
Pod:
d0dabfbc63b00c122aa9255cd6952f12e468055b95b459cf981e0c755adc8096
Container:
3355a1251afa772319eed2d7c1c31c8118c257fcb64dc01135fbfe3f050a18ee
┌─gerlof-laptop ~/docker/demo #
└─╼podman logs demo_kube
/

Describe the results you received:
pwd returns / when using podman play kube.

Describe the results you expected:
pwd returns /bin when using podman play kube (or whatever else is specified as argument to WORKDIR)

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

Output of podman version:

Version:            1.8.0
RemoteAPI Version:  1
Go Version:         go1.13.7
Git Commit:         2ced9094d4728dd09f60a177faa32339a8d0f721
Built:              Sun Feb  9 22:50:51 2020
OS/Arch:            linux/amd64

Output of podman info --debug:

debug:
  compiler: gc
  git commit: 2ced9094d4728dd09f60a177faa32339a8d0f721
  go version: go1.13.7
  podman version: 1.8.0
host:
  BuildahVersion: 1.13.1
  CgroupVersion: v1
  Conmon:
    package: Unknown
    path: /usr/bin/conmon
    version: 'conmon version 2.0.9, commit: 60b42f20f222df9da07a01ee444327348b9f54ee'
  Distribution:
    distribution: arch
    version: unknown
  MemFree: 2360471552
  MemTotal: 8243208192
  OCIRuntime:
    name: runc
    package: Unknown
    path: /usr/bin/runc
    version: |-
      runc version 1.0.0-rc10
      commit: dc9208a3303feef5b3839f4323d9beb36df0a9dd
      spec: 1.0.1-dev
  SwapFree: 8620670976
  SwapTotal: 8620670976
  arch: amd64
  cpus: 8
  eventlogger: journald
  hostname: gerlof-laptop
  kernel: 5.5.2-arch2-2
  os: linux
  rootless: false
  uptime: 55m 1.32s
registries:
  search:
  - docker.io
  - registry.fedoraproject.org
  - quay.io
  - registry.access.redhat.com
  - registry.centos.org
store:
  ConfigFile: /etc/containers/storage.conf
  ContainerStore:
    number: 23
  GraphDriverName: overlay
  GraphOptions:
    overlay.mountopt: nodev
  GraphRoot: /var/lib/containers/storage
  GraphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "true"
  ImageStore:
    number: 22
  RunRoot: /var/run/containers/storage
  VolumePath: /var/lib/containers/storage/volumes

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

┌─gerlof-laptop ~/docker/demo #
└─╼pacman -Qs podman
local/podman 1.8.0-1
    Tool and library for running OCI-based containers in pods

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

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Feb 11, 2020
@gfokkema gfokkema changed the title podman play kube does not seem to respect WORKDIR set in Dockerfile podman play kube does not seem to respect WORKDIR set in Dockerfile Feb 11, 2020
@rhatdan
Copy link
Member

rhatdan commented Feb 11, 2020

Is working dir specified in the generated yaml file?

@rhatdan rhatdan added the Good First Issue This issue would be a good issue for a first time contributor to undertake. label Feb 11, 2020
@rhatdan
Copy link
Member

rhatdan commented Feb 11, 2020

Looks like a good first issue, might be other fields we are not grabbing from the container image.

@gfokkema
Copy link
Author

gfokkema commented Feb 11, 2020

podman generate kube demo_run indeed outputs a workingDir: /bin which I've intentionally not specified in the yaml in the bug report.

Is working dir specified in the generated yaml file?

Ie, yes.

But since WORKDIR is specified in the Dockerfile (ie, in the image?) I'd expect podman to pick that up regardless. Is that assumption wrong?

@rhatdan
Copy link
Member

rhatdan commented Feb 11, 2020

No your assumption is correct.

podman run and podman play should both grab the images defaults before they run a container unless they are overridden by the user or kube.yaml file.

@vrothberg
Copy link
Member

Fixed in #5177, closing.

@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 Sep 23, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Good First Issue This issue would be a good issue for a first time contributor to undertake. 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.
Projects
None yet
Development

No branches or pull requests

5 participants