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

Crash when processing Docker's "hello world" #117

Closed
armijnhemel opened this issue Nov 7, 2018 · 6 comments
Closed

Crash when processing Docker's "hello world" #117

armijnhemel opened this issue Nov 7, 2018 · 6 comments
Labels
bug Something went wrong

Comments

@armijnhemel
Copy link

I tried to generate a report for Docker's hello world image, but tern crashed:

$ ./tern report -i docker.io/hello-world:latest
2018-11-07 20:44:35,758 - DEBUG - tern - Starting...
2018-11-07 20:44:35,759 - DEBUG - container - Running command: sudo docker ps
2018-11-07 20:44:35,787 - DEBUG - report - Setting up...
2018-11-07 20:44:35,788 - DEBUG - container - Running command: sudo docker images docker.io/hello-world:latest
2018-11-07 20:44:35,817 - DEBUG - container - Running command: sudo docker save docker.io/hello-world:latest
2018-11-07 20:44:35,853 - WARNING - report - Cannot retrieve full image metadata
2018-11-07 20:44:35,853 - DEBUG - report - Teardown...
2018-11-07 20:44:35,853 - DEBUG - rootfs - Running command: sudo rm -rf temp/mergedir
Traceback (most recent call last):
File "./tern", line 91, in
main(args)
File "./tern", line 47, in main
report.execute_docker_image(args)
File "/home/armijn/git/tern/report/report.py", line 402, in execute_docker_image
teardown()
File "/home/armijn/git/tern/report/report.py", line 75, in teardown
rootfs.clean_up()
File "/home/armijn/git/tern/utils/rootfs.py", line 163, in clean_up
root_command(remove, mergedir_path)
File "/home/armijn/git/tern/utils/rootfs.py", line 57, in root_command
raise subprocess.CalledProcessError(1, cmd=full_cmd, output=error)
subprocess.CalledProcessError: Command '['sudo', 'rm', '-rf', 'temp/mergedir']' returned non-zero exit status 1.

This is with 61f3a67

@nishakm nishakm added the bug Something went wrong label Nov 7, 2018
@nishakm
Copy link
Contributor

nishakm commented Nov 7, 2018

2018-11-07 20:44:35,788 - DEBUG - container - Running command: sudo docker images docker.io/hello-world:latest
2018-11-07 20:44:35,817 - DEBUG - container - Running command: sudo docker save docker.io/hello-world:latest
2018-11-07 20:44:35,853 - WARNING - report - Cannot retrieve full image metadata

Looks like there was an error in running docker save docker.io/hello-world:latest

@nishakm
Copy link
Contributor

nishakm commented Nov 7, 2018

I tried it locally and I am getting a different error:

2018-11-07 12:31:41,261 - DEBUG - tern - Starting...
2018-11-07 12:31:41,268 - DEBUG - container - Running command: docker ps
2018-11-07 12:31:41,344 - DEBUG - report - Setting up...
2018-11-07 12:31:45,410 - DEBUG - container - Running command: docker images docker.io/hello-world:latest
2018-11-07 12:31:45,478 - DEBUG - container - Running command: docker save docker.io/hello-world:latest
[sudo] password for nisha: 
2018-11-07 12:31:51,953 - DEBUG - rootfs - Running command: sudo mount -o bind temp/f22789aafb439644ab76948424a0c1b64f328cecde82c95edad3813aaadbe077/contents temp/mergedir
2018-11-07 12:31:52,019 - WARNING - command_lib - No listing for key . Consider adding this listing to command_lib/base.yml.

2018-11-07 12:31:52,020 - WARNING - report - No shell listing in command library. Using default shell
Traceback (most recent call last):
  File "./tern", line 91, in <module>
    main(args)
  File "./tern", line 47, in main
    report.execute_docker_image(args)
  File "/home/nisha/tern3.7/tern/report/report.py", line 393, in execute_docker_image
    analyze_docker_image(full_image)
  File "/home/nisha/tern3.7/tern/report/report.py", line 176, in analyze_docker_image
    binary, default_shell=constants.shell)
KeyError: 'binary'

So several issues:

  1. Tern doesn't know what the baseOS for this image is. But it doesn't exit gracefully if it cannot find it.
  2. It needs to check if all the set-up directories for mount exists before removing them

@armijnhemel
Copy link
Author

This is indeed the case:

$ docker save docker.io/hello-world:latest -o /tmp/backup
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.26/images/get?names=docker.io%2Fhello-world%3Alatest: dial unix /var/run/docker.sock: connect: permission denied

So the error message would not be what I had expected.

@armijnhemel
Copy link
Author

So several issues:

1. Tern doesn't know what the baseOS for this image is. But it doesn't exit gracefully if it cannot find it.

2. It needs to check if all the set-up directories for mount exists before removing them

This is the standard "hello world" from Docker: https://hub.docker.com/_/hello-world/

@nishakm
Copy link
Contributor

nishakm commented Nov 7, 2018

Docker's hello-world container consists of only 1 executable file hello. This file has no information on version, license or project url. So unknown filesystem is probably a better warning for this content. Furthermore, Docker's hello-world container is only used for checking if Docker is installed properly on your machine and nothing else. So I don't think it makes any sense adding hello to the command library.
The two issues stated above are still valid. Thanks for testing this out @armijnhemel!

@nishakm
Copy link
Contributor

nishakm commented Nov 14, 2018

Fixed in issues #120 and #121

@nishakm nishakm closed this as completed Nov 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something went wrong
Projects
None yet
Development

No branches or pull requests

2 participants