banyanops / collector

A framework for Static Analysis of Docker container images
Other
290 stars 23 forks source link

Creation of container based on pulled image fails #23

Closed cvtienhoven closed 8 years ago

cvtienhoven commented 8 years ago

I'm running the collector as a docker container, and it communicates via a unix socket with the docker daemon. When trying to check an image, it seems like the pullImage action succeeds, but then the collector tries to create a container from the image based on the ID, which fails. I substituted the actual registry and repo with and . I might be doing something wrong, but perhaps you want to take a look. Thanks in advance :)

[13:19:13 2016/01/12 +0000] [INFO] (main.checkRepoList:261) Repolist: /banyandir/hostcollector/repolist not specified
[13:19:13 2016/01/12 +0000] [INFO] (main.checkRepoList:291) Limiting collection to the following repos:
[13:19:13 2016/01/12 +0000] [INFO] (main.checkRepoList:293) <repo>
[13:19:13 2016/01/12 +0000] [INFO] (main.DoIteration:74) Obtained 1 new metadata items in this iteration
[13:19:13 2016/01/12 +0000] [INFO] (collector.(*FileWriter).AppendImageMetadata:72) Appending image metadata to file...
[13:19:13 2016/01/12 +0000] [INFO] (main.DoIteration:105) Starting to apply maxImages limit to repo <repo>
[13:19:13 2016/01/12 +0000] [INFO] (collector.PullImage:31) PullImage downloading /images/create?fromImage=<registry>/<repo>:latest, Image ID: 69f597566a32764bdd546bc2b517e125fa1321e21ae54007e92269a47adae399
[13:19:17 2016/01/12 +0000] [INFO] (collector.createCmd:256) Executing command: docker [PATH=/banyancollector/bin:$PATH bash-static /banyancollector/defaultscripts/pkgextractscript.sh]
[13:19:17 2016/01/12 +0000] [EROR] (except.Error:27) DockerAPI URL: http://example.com/containers/create status code: 404error: No such image: 69f597566a32764bdd546bc2b517e125fa1321e21ae54007e92269a47adae399:latest
 : Error in Remote Docker API call:  /containers/create {"User":"0","AttachStdin":false,"AttachStdout":true,"AttachStderr":true,"Tty":false,"Env":null,"Cmd":["PATH=/banyancollector/bin:$PATH bash-static /banyancollector/defaultscripts/pkgextractscript.sh"],"Entrypoint":["/banyancollector/bin/bash-static","-c"],"Image":"69f597566a32764bdd546bc2b517e125fa1321e21ae54007e92269a47adae399","Labels":null,"WorkingDir":"","HostConfig":{"Binds":["/root/.banyan/hosttarget:/banyancollector:ro"],"Links":null,"Privileged":false,"VolumesFrom":null}}
[13:19:17 2016/01/12 +0000] [EROR] (except.Error:27) DockerAPI URL: http://example.com/containers/create status code: 404error: No such image: 69f597566a32764bdd546bc2b517e125fa1321e21ae54007e92269a47adae399:latest
 : Error in creating container
[13:19:17 2016/01/12 +0000] [EROR] (except.Error:27) DockerAPI URL: http://example.com/containers/create status code: 404error: No such image: 69f597566a32764bdd546bc2b517e125fa1321e21ae54007e92269a47adae399:latest
 : Error in running script:  pkgextractscript.sh
[13:19:17 2016/01/12 +0000] [INFO] (collector.(*FileWriter).WriteImageAllData:37) Writing image (pkg and other) data into file...
[13:19:17 2016/01/12 +0000] [INFO] (main.DoIteration:158) No pulled images left to process in this iteration
[13:19:17 2016/01/12 +0000] [INFO] (main.InfLoop:336) Looping in 60 seconds
yoshiotu commented 8 years ago

Thanks for reporting this. I think this happened because collector had no support for the registry v2 token auth flow. I just now added support for that and pushed a new release (built version available on docker hub "docker pull banyanops/collector"). Hope it works.