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

Can't build images with Dockerfile samples #1235

Closed
armintaenzertng opened this issue Jul 10, 2023 · 4 comments · Fixed by #1238
Closed

Can't build images with Dockerfile samples #1235

armintaenzertng opened this issue Jul 10, 2023 · 4 comments · Fixed by #1238

Comments

@armintaenzertng
Copy link

Four of the provided Dockerfiles in the samples directory lead to errors when I try to build an image from them.
These are the ones under debian_vim, photon_3_layers, photon_git, and photon_openjre.

To Reproduce
docker build ./samples/debian_vim
and similar for the other sample directories.

Error in terminal

$ docker build ./samples/debian_vim
[+] Building 1.3s (5/5) FINISHED                                                                                                                                                                                                                                                                                        
 => [internal] load .dockerignore                                                                                                                                                                                                                                                                                  0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                                                    0.0s
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                                               0.0s
 => => transferring dockerfile: 215B                                                                                                                                                                                                                                                                               0.0s
 => [internal] load metadata for docker.io/library/debian:jessie                                                                                                                                                                                                                                                   0.0s
 => [1/2] FROM docker.io/library/debian:jessie                                                                                                                                                                                                                                                                     0.0s
 => ERROR [2/2] RUN apt-get update && apt-get install -y vim && apt-get clean                                                                                                                                                                                                                                      1.2s
------                                                                                                                                                                                                                                                                                                                  
 > [2/2] RUN apt-get update && apt-get install -y vim && apt-get clean:                                                                                                                                                                                                                                                 
#0 0.888 Ign http://deb.debian.org jessie InRelease                                                                                                                                                                                                                                                                     
#0 0.888 Ign http://security.debian.org jessie/updates InRelease                                                                                                                                                                                                                                                        
#0 0.907 Ign http://deb.debian.org jessie-updates InRelease                                                                                                                                                                                                                                                             
#0 0.907 Ign http://security.debian.org jessie/updates Release.gpg                                                                                                                                                                                                                                                      
#0 0.926 Ign http://deb.debian.org jessie Release.gpg
#0 0.932 Ign http://security.debian.org jessie/updates Release
#0 0.953 Err http://security.debian.org jessie/updates/main amd64 Packages
#0 0.953   
#0 0.964 Ign http://deb.debian.org jessie-updates Release.gpg
#0 0.973 Err http://security.debian.org jessie/updates/main amd64 Packages
#0 0.973   
#0 0.985 Ign http://deb.debian.org jessie Release
#0 0.992 Err http://security.debian.org jessie/updates/main amd64 Packages
#0 0.992   
#0 1.013 Ign http://deb.debian.org jessie-updates Release
#0 1.013 Err http://security.debian.org jessie/updates/main amd64 Packages
#0 1.013   
#0 1.033 Err http://security.debian.org jessie/updates/main amd64 Packages
#0 1.033   404  Not Found [IP: 151.101.194.132 80]
#0 1.204 Err http://deb.debian.org jessie/main amd64 Packages
#0 1.204   404  Not Found
#0 1.223 Err http://deb.debian.org jessie-updates/main amd64 Packages
#0 1.223   404  Not Found
#0 1.225 W: Failed to fetch http://security.debian.org/debian-security/dists/jessie/updates/main/binary-amd64/Packages  404  Not Found [IP: 151.101.194.132 80]
#0 1.225 
#0 1.225 W: Failed to fetch http://deb.debian.org/debian/dists/jessie/main/binary-amd64/Packages  404  Not Found
#0 1.225 
#0 1.225 W: Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/main/binary-amd64/Packages  404  Not Found
#0 1.225 
#0 1.225 E: Some index files failed to download. They have been ignored, or old ones used instead.
------
Dockerfile:4
--------------------
   2 |     # SPDX-License-Identifier: BSD-2-Clause
   3 |     FROM debian:jessie
   4 | >>> RUN apt-get update && apt-get install -y vim && apt-get clean
   5 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c apt-get update && apt-get install -y vim && apt-get clean" did not complete successfully: exit code: 100

$ docker build ./samples/photon_3_layers/
[+] Building 0.4s (5/6)                                                                                                                                                                                                                                                                                                 
 => [internal] load .dockerignore                                                                                                                                                                                                                                                                                  0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                                                    0.0s
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                                               0.0s
 => => transferring dockerfile: 257B                                                                                                                                                                                                                                                                               0.0s
 => [internal] load metadata for docker.io/vmware/photon2:GA                                                                                                                                                                                                                                                       0.0s
 => [1/3] FROM docker.io/vmware/photon2:GA                                                                                                                                                                                                                                                                         0.0s
 => ERROR [2/3] RUN tyum install -y git && tyum clean all                                                                                                                                                                                                                                                          0.3s
------                                                                                                                                                                                                                                                                                                                  
 > [2/3] RUN tyum install -y git && tyum clean all:                                                                                                                                                                                                                                                                     
#0 0.263 curl#6: Couldn't resolve host name
#0 0.263 Error: Failed to synchronize cache for repo 'VMware Photon Linux 2.0(x86_64) Updates' from 'https://dl.bintray.com/vmware/photon_updates_2.0_x86_64'
#0 0.276 curl#6: Couldn't resolve host name
#0 0.276 Error: Failed to synchronize cache for repo 'VMware Photon Linux 2.0(x86_64)' from 'https://dl.bintray.com/vmware/photon_release_2.0_x86_64'
#0 0.288 curl#6: Couldn't resolve host name
#0 0.288 Error: Failed to synchronize cache for repo 'VMware Photon Extras 2.0(x86_64)' from 'https://dl.bintray.com/vmware/photon_extras_2.0_x86_64'
#0 0.290 Error(1011) : No matching packages
#0 0.290 Refreshing metadata for: 'VMware Photon Linux 2.0(x86_64) Updates'
#0 0.290 Disabling Repo: 'VMware Photon Linux 2.0(x86_64) Updates'
#0 0.290 Refreshing metadata for: 'VMware Photon Linux 2.0(x86_64)'
#0 0.290 Disabling Repo: 'VMware Photon Linux 2.0(x86_64)'
#0 0.290 Refreshing metadata for: 'VMware Photon Extras 2.0(x86_64)'
#0 0.290 Disabling Repo: 'VMware Photon Extras 2.0(x86_64)'
#0 0.290 No package git available
------
Dockerfile:4
--------------------
   2 |     # SPDX-License-Identifier: BSD-2-Clause
   3 |     FROM vmware/photon2:GA                 
   4 | >>> RUN tyum install -y git && tyum clean all
   5 |     RUN tyum install -y vim && tyum clean all
   6 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c tyum install -y git && tyum clean all" did not complete successfully: exit code: 243

$ docker build ./samples/photon_git/
[+] Building 0.4s (5/5) FINISHED                                                                                                                                                                                                                                                                                        
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                                               0.0s
 => => transferring dockerfile: 215B                                                                                                                                                                                                                                                                               0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                                                  0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                                                    0.0s
 => [internal] load metadata for docker.io/vmware/photon:1.0                                                                                                                                                                                                                                                       0.0s
 => [1/2] FROM docker.io/vmware/photon:1.0                                                                                                                                                                                                                                                                         0.0s
 => ERROR [2/2] RUN tyum install -y git && tyum clean all                                                                                                                                                                                                                                                          0.4s
------
 > [2/2] RUN tyum install -y git && tyum clean all:
#0 0.277 curl#6: Couldn't resolve host name
#0 0.277 Error: Failed to synchronize cache for repo 'VMware Photon Linux 1.0(x86_64)Updates' from 'https://dl.bintray.com/vmware/photon_updates_1.0_x86_64'
#0 0.297 curl#6: Couldn't resolve host name
#0 0.297 Error: Failed to synchronize cache for repo 'VMware Lightwave 1.0(x86_64)' from 'https://dl.bintray.com/vmware/lightwave'
#0 0.318 curl#6: Couldn't resolve host name
#0 0.318 Error: Failed to synchronize cache for repo 'VMware Photon Linux 1.0(x86_64)' from 'https://dl.bintray.com/vmware/photon_release_1.0_x86_64'
#0 0.341 curl#6: Couldn't resolve host name
#0 0.341 Error: Failed to synchronize cache for repo 'VMware Photon Extras 1.0(x86_64)' from 'https://dl.bintray.com/vmware/photon_extras'
#0 0.344 Refreshing metadata for: 'VMware Photon Linux 1.0(x86_64)Updates'
#0 0.344 Disabling Repo: 'VMware Photon Linux 1.0(x86_64)Updates'
#0 0.344 Refreshing metadata for: 'VMware Lightwave 1.0(x86_64)'
#0 0.344 Disabling Repo: 'VMware Lightwave 1.0(x86_64)'
#0 0.344 Refreshing metadata for: 'VMware Photon Linux 1.0(x86_64)'
#0 0.344 Disabling Repo: 'VMware Photon Linux 1.0(x86_64)'
#0 0.344 Refreshing metadata for: 'VMware Photon Extras 1.0(x86_64)'
#0 0.344 Disabling Repo: 'VMware Photon Extras 1.0(x86_64)'
#0 0.344 No package git available
#0 0.344 Error(1011) : No matching packages
------
Dockerfile:4
--------------------
   2 |     # SPDX-License-Identifier: BSD-2-Clause
   3 |     FROM vmware/photon:1.0                 
   4 | >>> RUN tyum install -y git && tyum clean all
   5 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c tyum install -y git && tyum clean all" did not complete successfully: exit code: 243

$ docker build ./samples/photon_openjre/
[+] Building 0.5s (5/5) FINISHED                                                                                                                                                                                                                                                                                        
 => [internal] load .dockerignore                                                                                                                                                                                                                                                                                  0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                                                    0.0s
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                                               0.0s
 => => transferring dockerfile: 219B                                                                                                                                                                                                                                                                               0.0s
 => [internal] load metadata for docker.io/vmware/photon:1.0                                                                                                                                                                                                                                                       0.0s
 => CACHED [1/2] FROM docker.io/vmware/photon:1.0                                                                                                                                                                                                                                                                  0.0s
 => ERROR [2/2] RUN tyum install -y openjre && tyum clean all                                                                                                                                                                                                                                                      0.4s
------                                                                                                                                                                                                                                                                                                                  
 > [2/2] RUN tyum install -y openjre && tyum clean all:                                                                                                                                                                                                                                                                 
#0 0.316 curl#6: Couldn't resolve host name                                                                                                                                                                                                                                                                             
#0 0.316 Error: Failed to synchronize cache for repo 'VMware Photon Linux 1.0(x86_64)Updates' from 'https://dl.bintray.com/vmware/photon_updates_1.0_x86_64'                                                                                                                                                            
#0 0.336 curl#6: Couldn't resolve host name                                                                                                                                                                                                                                                                             
#0 0.336 Error: Failed to synchronize cache for repo 'VMware Lightwave 1.0(x86_64)' from 'https://dl.bintray.com/vmware/lightwave'                                                                                                                                                                                      
#0 0.359 curl#6: Couldn't resolve host name
#0 0.359 Error: Failed to synchronize cache for repo 'VMware Photon Linux 1.0(x86_64)' from 'https://dl.bintray.com/vmware/photon_release_1.0_x86_64'
#0 0.379 curl#6: Couldn't resolve host name
#0 0.379 Error: Failed to synchronize cache for repo 'VMware Photon Extras 1.0(x86_64)' from 'https://dl.bintray.com/vmware/photon_extras'
#0 0.383 Refreshing metadata for: 'VMware Photon Linux 1.0(x86_64)Updates'
#0 0.383 Disabling Repo: 'VMware Photon Linux 1.0(x86_64)Updates'
#0 0.383 Refreshing metadata for: 'VMware Lightwave 1.0(x86_64)'
#0 0.383 Disabling Repo: 'VMware Lightwave 1.0(x86_64)'
#0 0.383 Refreshing metadata for: 'VMware Photon Linux 1.0(x86_64)'
#0 0.383 Disabling Repo: 'VMware Photon Linux 1.0(x86_64)'
#0 0.383 Refreshing metadata for: 'VMware Photon Extras 1.0(x86_64)'
#0 0.383 Disabling Repo: 'VMware Photon Extras 1.0(x86_64)'
#0 0.383 No package openjre available
#0 0.383 Error(1011) : No matching packages
------
Dockerfile:4
--------------------
   2 |     # SPDX-License-Identifier: BSD-2-Clause
   3 |     FROM vmware/photon:1.0                 
   4 | >>> RUN tyum install -y openjre && tyum clean all
   5 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c tyum install -y openjre && tyum clean all" did not complete successfully: exit code: 243

Expected behavior
I expect the building of images from the provided Dockerfiles to succeed.

Environment you are running Tern on

  • Tern at commit 62507ed
  • Ubuntu 22.0.4
  • Python 3.10.6
@rnjudge
Copy link
Contributor

rnjudge commented Jul 10, 2023

Thanks @armintaenzertng. I'm not actually sure what those sample image Dockerfiles are for. Looks like @nishakm added them almost 5 years ago so I'm not terribly surprised they won't build. Are you trying to build the images to run Tern on them?

@armintaenzertng
Copy link
Author

Yes, I stumbled upon this while trying out the command described here in the README that uses these Dockerfiles.

@rnjudge
Copy link
Contributor

rnjudge commented Jul 11, 2023

Ah, good catch. I will update these files (and probably delete a handful of them since I don't want to maintain them all).

@rnjudge
Copy link
Contributor

rnjudge commented Jul 13, 2023

@armintaenzertng I looked at each of the files you had issues with but didn't quite reproduce all the same errors. Here's what I saw:

$ tern report -d samples/debian_vim/Dockerfile
2023-07-13 14:38:14,005 - DEBUG - run - Building Docker image with Dockerfile: debian_vim/Dockerfile
2023-07-13 14:38:16,296 - WARNING - docker_api - Build failed: no matching manifest for linux/arm64/v8 in the manifest list entries
2023-07-13 14:38:16,296 - WARNING - docker_api - Could not build Docker image
2023-07-13 14:38:16,296 - WARNING - run - Cannot build image
2023-07-13 14:38:16,296 - DEBUG - run - Analyzing base image...
2023-07-13 14:38:16,304 - DEBUG - docker_api - Checking if image "debian:jessie" is available on disk...
2023-07-13 14:38:16,305 - DEBUG - docker_api - Attempting to pull image "debian:jessie"
2023-07-13 14:38:18,096 - ERROR - docker_api - No such image: "debian:jessie"
2023-07-13 14:38:18,096 - ERROR - run - Cannot analyze base image

  • From what I see, debian:jessie is not available on Dockerhub anymore. Changed the base image to debian:bullseye fixed the issue.
$ tern report -d samples/photon_3_layers/Dockerfile
023-07-13 14:48:03,114 - DEBUG - run - Parsing Dockerfile...
2023-07-13 14:48:03,115 - DEBUG - run - Building Docker image with Dockerfile: photon_3_layers/Dockerfile
2023-07-13 14:48:08,555 - WARNING - docker_api - Build failed: The command '/bin/sh -c tyum install -y git && tyum clean all' returned a non-zero code: 1
  • photon images are hosted in their own dockerhub namespace now. I changed the image to be photon:3.0 and that fixes the issue.
$ tern report -d samples/photon_git/Dockerfile
023-07-13 14:54:36,976 - DEBUG - run - Parsing Dockerfile...
2023-07-13 14:54:36,977 - DEBUG - run - Building Docker image with Dockerfile: photon_git/Dockerfile
2023-07-13 14:54:43,797 - WARNING - docker_api - Build failed: The command '/bin/sh -c tyum install -y git && tyum clean all' returned a non-zero code: 1
2023-07-13 14:54:43,798 - WARNING - docker_api - Could not build Docker image
2023-07-13 14:54:43,798 - WARNING - run - Cannot build image
  • Same dockerhub namespace issue as above. Changed image to photon:5.0 which is latest available and Tern outputs correctly.
$ tern report -d samples/photon_openjre/Dockerfile
Same error as photon_git above
  • Same dockerhub namespace issue as above. Changed image to photon:5.0 which is latest available and Tern outputs correctly.

I'll push these changes and include them in the latest Tern release.

rnjudge added a commit to rnjudge/tern that referenced this issue Jul 13, 2023
There were several Dockerfiles in the `samples` repo that were referring
to base images that either no longer exist or are much out of date (5+
years). This commit updates the base images in those files so that
Tern/Docker can build and analyze them.

Resolves tern-tools#1235

Signed-off-by: Rose Judge <rjudge@vmware.com>
rnjudge added a commit that referenced this issue Jul 13, 2023
There were several Dockerfiles in the `samples` repo that were referring
to base images that either no longer exist or are much out of date (5+
years). This commit updates the base images in those files so that
Tern/Docker can build and analyze them.

Resolves #1235

Signed-off-by: Rose Judge <rjudge@vmware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants