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

BUG: caching does not work correctly with ARG #1507

Closed
h-vetinari opened this issue Apr 11, 2019 · 2 comments
Closed

BUG: caching does not work correctly with ARG #1507

h-vetinari opened this issue Apr 11, 2019 · 2 comments

Comments

@h-vetinari
Copy link

h-vetinari commented Apr 11, 2019

[Continuing from #1456; containers/podman#2250]

Using the following dockerfile (say, podman_test.dockrf):

FROM docker.io/library/ubuntu:bionic
ARG DEBIAN_FRONTEND=noninteractive

#RUN apt-get update && apt-get install tzdata -y --no-install-recommends

CMD ["bash"]

and build using sudo podman -t podman_test -f podman_test.dockrf ..

Afterwards, uncomment the RUN line and build again. The package is chosen to normally require user interaction, which would be suppressed at installation time by DEBIAN_FRONTEND=noninteractive. But while the build says:

$ sudo podman build -f podman-cache.dockrf .
STEP 1: FROM docker.io/library/ubuntu:bionic
STEP 2: ARG DEBIAN_FRONTEND=noninteractive
--> Using cache 0d0d6081636f891eefe257781e2d8445912eb2d321d3d19446cb28b1e6e32f4d
STEP 3: FROM 0d0d6081636f891eefe257781e2d8445912eb2d321d3d19446cb28b1e6e32f4d
STEP 4: RUN apt-get update && apt-get install tzdata -y --no-install-recommends
[...]

it ends up running into an error that's plainly due to DEBIAN_FRONTEND not being set:

debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /usr/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
Configuring tzdata
------------------

Please select the geographic area in which you live. Subsequent configuration
questions will narrow this down by presenting a list of cities, representing
the time zones in which they are located.

  1. Africa      4. Australia  7. Atlantic  10. Pacific  13. Etc
  2. America     5. Arctic     8. Europe    11. SystemV
  3. Antarctica  6. Asia       9. Indian    12. US
Geographic area:

Using --no-cache, the build succeeds.

@umohnani8
Copy link
Member

@h-vetinari which buildah version are you using? I am on 1.8-dev and this is working fine for me.

➜  buildah git:(args) ✗ sudo buildah bud --layers -t test .
STEP 1: FROM docker.io/library/ubuntu:bionic
Getting image source signatures
Copying blob 6e1bee0f8701 done
Copying blob 63366dfa0a50 done
Copying blob 041d4cd74a92 done
Copying blob 898c46f3b1a1 done
Copying config 94e814e2ef done
Writing manifest to image destination
Storing signatures
STEP 2: ARG DEBIAN_FRONTEND=noninteractive
STEP 3: CMD ["bash"]
STEP 4: COMMIT test
--> c66090b96815e73822bffd9712dbdab23ef6b39987bd5d8a12d0b832e06fbbd9

➜  buildah git:(args) ✗ sudo buildah images -a
REPOSITORY                 TAG      IMAGE ID       CREATED       SIZE
localhost/test             latest   c66090b96815   3 hours ago   91.4 MB
docker.io/library/ubuntu   bionic   94e814e2efa8   5 weeks ago   91.4 MB

➜  buildah git:(args) ✗ sudo buildah bud --layers -t test1 . 
STEP 1: FROM docker.io/library/ubuntu:bionic
STEP 2: ARG DEBIAN_FRONTEND=noninteractive
STEP 3: RUN apt-get update && apt-get install tzdata -y --no-install-recommends
Get:1 http://archive.ubuntu.com/ubuntu bionic InRelease [242 kB]
Get:2 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:3 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [410 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]       
Get:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]                
Get:6 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [11.3 MB]
Get:7 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [4171 B]
Get:8 http://security.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages [5436 B]
Get:9 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [301 kB]
Get:10 http://archive.ubuntu.com/ubuntu bionic/restricted amd64 Packages [13.5 kB]      
Get:11 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages [1344 kB]
Get:12 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages [186 kB]
Get:13 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [752 kB]
Get:14 http://archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [10.8 kB]
Get:15 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [7238 B]
Get:16 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1103 kB]
Get:17 http://archive.ubuntu.com/ubuntu bionic-backports/main amd64 Packages [942 B]
Get:18 http://archive.ubuntu.com/ubuntu bionic-backports/universe amd64 Packages [3659 B]
Fetched 16.0 MB in 3s (4757 kB/s)                          
Reading package lists... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  tzdata
0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
Need to get 189 kB of archives.
After this operation, 3104 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 tzdata all 2018i-0ubuntu0.18.04 [189 kB]
Fetched 189 kB in 1s (328 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package tzdata.
(Reading database ... 4039 files and directories currently installed.)
Preparing to unpack .../tzdata_2018i-0ubuntu0.18.04_all.deb ...
Unpacking tzdata (2018i-0ubuntu0.18.04) ...
Setting up tzdata (2018i-0ubuntu0.18.04) ...

Current default time zone: 'Etc/UTC'
Local time is now:      Wed Apr 17 17:02:46 UTC 2019.
Universal Time is now:  Wed Apr 17 17:02:46 UTC 2019.
Run 'dpkg-reconfigure tzdata' if you wish to change it.

--> 1c1931540eaab42dbda2867f12eb4d5d45ac7aa21b5ae5c240f85c827f4d1450
STEP 4: CMD ["bash"]
STEP 5: COMMIT test1
--> c8bbf1c105487c364e94368c68b6b97ca4d57dceac8d42729d63af0ad990f5ec

➜  buildah git:(args) ✗ sudo buildah images -a
REPOSITORY                 TAG      IMAGE ID       CREATED          SIZE
localhost/test1            latest   c8bbf1c10548   38 seconds ago   121 MB
<none>                     <none>   1c1931540eaa   40 seconds ago   121 MB
localhost/test             latest   c66090b96815   3 hours ago      91.4 MB
docker.io/library/ubuntu   bionic   94e814e2efa8   5 weeks ago      91.4 MB

➜  buildah git:(args) ✗ sudo buildah version
Version:         1.8-dev
Go Version:      go1.11.5
Image Spec:      1.0.0
Runtime Spec:    1.0.0
CNI Spec:        0.4.0
libcni Version:  v0.7.0-rc2
Git Commit:      d8fe4002
Built:           Wed Apr 17 10:16:50 2019
OS/Arch:         linux/amd64

@h-vetinari
Copy link
Author

@umohnani8
I didn't know that podman vendors buildah, so I had always just been testing podman build. It does work on buildah master with buildah bud, and following the merge of containers/podman#2931 (and the latest nightly build through PPA), it now also works with podman build. :)

Closing since this issue is now solved.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants