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' cannot create images with empty Dockerfile #1993

Closed
harche opened this issue Dec 12, 2018 · 9 comments
Closed

'podman build' cannot create images with empty Dockerfile #1993

harche opened this issue Dec 12, 2018 · 9 comments
Assignees
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@harche
Copy link

harche commented Dec 12, 2018

Is this a BUG REPORT or FEATURE REQUEST?:

/kind bug

Description

[root@rhel8 from-scratch]# cat Dockerfile 
FROM scratch
# 
[root@rhel8 from-scratch]# buildah bud -t test1 .
STEP 1: FROM scratch
STEP 2: COMMIT containers-storage:[overlay@/var/lib/containers/storage+/var/run/containers/storage:overlay.override_kernel_check=true]localhost/test1:latest
Getting image source signatures
Copying blob sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1
 32 B / 32 B [==============================================================] 0s
Copying config sha256:45fc63f3e5b4223be70bbd336ef205a59e92eff16b115cc9be722aa56a2a33b2
 340 B / 340 B [============================================================] 0s
Writing manifest to image destination
Storing signatures
--> 45fc63f3e5b4223be70bbd336ef205a59e92eff16b115cc9be722aa56a2a33b2

[root@rhel8 from-scratch]# buildah images 
IMAGE ID             IMAGE NAME                                               CREATED AT             SIZE
45fc63f3e5b4         localhost/test1:latest                                   Dec 12, 2018 05:39     1.71 KB

[root@rhel8 from-scratch]# podman images 
REPOSITORY        TAG      IMAGE ID       CREATED          SIZE
localhost/test1   latest   45fc63f3e5b4   24 seconds ago   1.71kB

So buildah can create an image from a Dockerfile that has only FROM scratch. Now let's try with podman build

First cleanup,

[root@rhel8 from-scratch]# buildah rmi localhost/test1:latest
untagged: localhost/test1:latest
45fc63f3e5b4223be70bbd336ef205a59e92eff16b115cc9be722aa56a2a33b2

[root@rhel8 from-scratch]# podman images 
[root@rhel8 from-scratch]# buildah images 
[root@rhel8 from-scratch]# 
[root@rhel8 from-scratch]# podman build -t test1 -f Dockerfile
STEP 1: FROM scratch
[root@rhel8 from-scratch]# podman images 
[root@rhel8 from-scratch]# buildah images
[root@rhel8 from-scratch]# 

As you can see podman build didn't create any image, but buildah bud was able to. Now let's try this,

[root@rhel8 from-scratch]# touch test 
[root@rhel8 from-scratch]# echo "COPY test /" >> Dockerfile 
[root@rhel8 from-scratch]# cat Dockerfile 
FROM scratch
COPY test /
[root@rhel8 from-scratch]# ls
Dockerfile  test
[root@rhel8 from-scratch]# podman build -t test1 -f Dockerfile
STEP 1: FROM scratch
STEP 2: COPY test /
--> e40aa9a9f7f3dc0e05dfd21dd939e88c31cef6d16856631ad089f7c337e53326
STEP 3: COMMIT test1
[root@rhel8 from-scratch]# podman images
REPOSITORY        TAG      IMAGE ID       CREATED         SIZE
localhost/test1   latest   e40aa9a9f7f3   3 seconds ago   2.26kB
[root@rhel8 from-scratch]# buildah images
IMAGE ID             IMAGE NAME                                               CREATED AT             SIZE
e40aa9a9f7f3         localhost/test1:latest                                   Dec 12, 2018 05:45     2.26 KB
[root@rhel8 from-scratch]# 

So this time it worked if some content was added in Dockerfile apart from the first line.

This is issue is affecting the test case here, https://github.com/containers/libpod/blob/master/test/test_podman_build.sh#L23

Steps to reproduce the issue:

  1. Create a Dockerfile with just FROM scratch. podman build won't be able to create an image, while buildah bud will be able to.

Describe the results you received:
container image should have gotten created.

Describe the results you expected:
No container image got created.

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

Output of podman version:

Version:       0.10.1.3
Go Version:    go1.10.3
OS/Arch:       linux/ppc64le

Output of podman info:

host:
  BuildahVersion: 1.5-dev
  Conmon:
    package: podman-0.10.1.3-5.gitdb08685.el8+2131+7e3e9e07.ppc64le
    path: /usr/libexec/podman/conmon
    version: 'conmon version 1.12.0-dev, commit: 6a63dada254d8efb3e9b30ed93ad55ab6622bd29-dirty'
  Distribution:
    distribution: '"rhel"'
    version: "8.0"
  MemFree: 2873229312
  MemTotal: 3722903552
  OCIRuntime:
    package: runc-1.0.0-52.rc5.dev.git2abd837.el8+1884+9fee228c.ppc64le
    path: /usr/bin/runc
    version: 'runc version spec: 1.0.0'
  SwapFree: 4382982144
  SwapTotal: 4395565056
  arch: ppc64le
  cpus: 1
  hostname: rhel8
  kernel: 4.18.0-40.el8.ppc64le
  os: linux
  uptime: 50h 47m 42.51s (Approximately 2.08 days)
insecure registries:
  registries: []
registries:
  registries:
  - registry.redhat.io
  - quay.io
  - docker.io
store:
  ContainerStore:
    number: 18
  GraphDriverName: overlay
  GraphOptions:
  - overlay.override_kernel_check=true
  GraphRoot: /var/lib/containers/storage
  GraphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
  ImageStore:
    number: 1
  RunRoot: /var/run/containers/storage

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

@mheon mheon added bug and removed Third Party labels Dec 12, 2018
@mheon
Copy link
Member

mheon commented Dec 12, 2018

@TomSweeneyRedHat Since we're calling straight into buildah code here, what are we looking at? Do we need a newer version of buildah or do we have a bug in our wrapper code?

@TomSweeneyRedHat TomSweeneyRedHat self-assigned this Dec 12, 2018
@TomSweeneyRedHat
Copy link
Member

@mheon my guess is a new variant of Buildah, but there may be a wrapper issue. I'll grab this and will see.

@rhatdan
Copy link
Member

rhatdan commented Dec 12, 2018

Probably need to fix, but I don't see where this is a real world issue. Unless you want to ship an totaly empty image, that would be very secure. :^)

@harche
Copy link
Author

harche commented Dec 12, 2018

@rhatdan as I mentioned above the test case, https://github.com/containers/libpod/blob/master/test/test_podman_build.sh#L23 is failing on my system because of this issue.

@TomSweeneyRedHat
Copy link
Member

I tried to vendor in Buildah to fix this but still the same behavior. I also tried a one-line Dockerfile with Fedora instead of scratch and that worked fine too. This is beginning to feel like a Podman build wrapper error, but I can't imagine... Will dig more tomorrow.

@rhatdan
Copy link
Member

rhatdan commented Dec 13, 2018

This works ok in Buildah?

@TomSweeneyRedHat
Copy link
Member

Perfectly fine in Buildah, that's the odd part.

@TomSweeneyRedHat
Copy link
Member

OK, I know what the difference is at least. By default Buildah sets the default value of the --layers parameter to false. Podman sets the same value to true. If you do

podman build  --layers=false -t tom -f ~/Dockerfile.scratch .

The image will build. Now I need to figure out why it's not building with layers set to true.

@vrothberg
Copy link
Member

This works now, thanks to @TomSweeneyRedHat 's great fixes.

@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 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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

6 participants