nexdrew / rekcod

docker inspect :mag: → docker run :runner:
ISC License
371 stars 32 forks source link

Passing files or piping stdin to the containerized version #43

Closed lllamnyp closed 4 years ago

lllamnyp commented 5 years ago

The documentation suggests the following way to interpret a json file:

alias rekcod="docker run --rm -v /var/run/docker.sock:/var/run/docker.sock nexdrew/rekcod"
rekcod one.json

There is also an undocumented way to pass stdin to the tool:

cat one.json | rekcod

Neither way works. However, if one changes

alias rekcod="docker run --rm -i -v /var/run/docker.sock:/var/run/docker.sock nexdrew/rekcod"

(note the -i flag) then cat one.json | rekcod works, while passing a filename requires the following construct:

docker run --rm -i -v /var/run/docker.sock:/var/run/docker.sock \
  -v `pwd`/one.json:/one.json nexdrew/rekcod /one.json

(i.e. mount the file into the container) The documentation could be clearer on this.

nexdrew commented 5 years ago

@lllamnyp Yes, you're absolutely right, thank you for the suggestion!

We've actually encountered this before (see #38), though apparently I didn't update the docs.

The documentation was originally written with usage of the Node installation in mind - it was only later that (thanks to @MPV in #27) we created a "Docker only" installation and I threw some minimal instructions in there.

Perhaps it would be better to provide a "Docker only" version for each CLI example in the readme? While it makes sense to add -i to the alias version of rekcod, defining the alias to mount a single hardcoded filename probably doesn't.

I will attempt to update the docs soon-ish, unless you want to create a PR yourself. Otherwise, thanks for reporting this and for the suggestions!

nexdrew commented 4 years ago

Well, it wasn't "soon-ish", but I finally updated the docs to (hopefully) clarify how to use the Docker-only installation with files on the host system.

Thanks for reporting this!