github / semantic

Parsing, analyzing, and comparing source code across many languages
8.94k stars 454 forks source link

When using semantic as a docker image, I get `openBinaryFile: does not exist` #611

Closed ch3rn0v closed 4 years ago

ch3rn0v commented 4 years ago

When trying to parse a file, I get an error openBinaryFile: does not exist.

When I build semantic locally, this error is resolved by specifying the full path instead of something like ~/....

However, when I use semantic as a docker image, I still get the same error even when I provide the full path:

sudo docker run semantic -- parse --json /full/path/to/a/file.js

/full/path/to/a/file.js: openBinaryFile: does not exist (No such file or directory)

Docker version: Docker version 19.03.12, build 48a66213fe OS: Ubuntu 19.10 64-bit

joshvera commented 4 years ago

@ch3rn0v Hey! It looks like that's occurring because you didn't specify a volume for docker to mount.

Something like the following should work:

sudo docker run -v /full/path/to/a:/path/inside/docker docker.pkg.github.com/github/semantic/semantic:0.7.0.0 -- parse --json /path/inside/docker/file.js

Reference: https://docs.docker.com/storage/volumes/

ch3rn0v commented 4 years ago

Hi @joshvera ! Thanks a lot, this was indeed the reason. After I fixed it according to your suggestion, it worked.


On a related note: you might be interested that in order to pass semantic a dynamically generated list of files (using find, for instance) I had to overwrite Dockerfile's entrypoint. Is this the supposed approach?