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

doc(readme): Add docker usage doc #3103

Merged
merged 2 commits into from
May 1, 2024
Merged

Conversation

sheepster1
Copy link
Contributor

@sheepster1 sheepster1 commented Apr 30, 2024

Hey, added a short doc on running the tool inline with docker

README.md Outdated Show resolved Hide resolved
@itchyny
Copy link
Contributor

itchyny commented May 1, 2024

This is nice improvement.

Co-authored-by: itchyny <itchyny@cybozu.co.jp>
@emanuele6 emanuele6 merged commit d875ff5 into jqlang:master May 1, 2024
28 checks passed
@emanuele6
Copy link
Member

Thank you

```
##### Example: Extracting the version from a `package.json` file with a mounted volume
```bash
docker run --rm -i -v "${PWD}":/pwd -w /pwd ghcr.io/jqlang/jq:latest '.version' package.json
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One possible improvement could be to do -v "$PWD:$PWD" -w "$PWD" to make paths work more as expected

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand, Can you maybe share an example command that will act in an unexpected way?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If one would happen to use absolute host paths in arguments etc they won't work, ex:

docker run --rm -i -v "${PWD}":/pwd -w /pwd ghcr.io/jqlang/jq:latest -f $PWD/file.jq ...

but even with the -v -w trick above paths outside host $PWD will not work... so not perfect either.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a slight difference no need to fix. -f accepts relative path, env.PWD is different, but should be ok.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened a PR #3105

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@itchyny yeap not big thing but it has hit me a couple of times before :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants