Show HN: Dockerized – Run CLI tools without installation (github.com)
Example:
dockerized npm init
dockerized python2 somescript.py
Run an older version of a tool: NODE_VERSION=15.0 dockerized node
Use cases:- Maintaining multiple versions of an app
- Installing without polluting host machine
- Quickly run some commands you may not have installed
Features:
- intuitive use. Just the original command, but with 'dockerized' in front.
- dockerized apps can access the current directory and read/modify files, just like native apps.
- no need to know which docker image this package comes from.
- support for tools which don't have an official docker image.
- container cleaned up after use.
- ability to specify the version.
- version specification per directory (share exact versions with your team mates).
The inner workings are pretty simple, it's just a docker-compose file.
As expected with dockerization, there are limitations related to networking, and file persistence (outside current dir), but it can make life easy for simple scenarios.
Pull requests welcome!
24 comments
[ 2.7 ms ] story [ 64.1 ms ] threadEnvCLI is another one that's been on my list to check out. It looks quite nice too: https://github.com/EnvCLI/EnvCLI
Edit: "Windows support is theoretically possible, but not implemented yet" :-(
$ whalebrew install whalebrew/wget Unable to find image 'whalebrew/wget' locally Using default tag: latest latest: Pulling from whalebrew/wget 540db60ca938: Pull complete fe215536b7c5: Pull complete Digest: sha256:dff6b84c2e317d4c1a6a81c55e6f91d46b73dc19713f53d06cf3a3b19b0c7815 Status: Downloaded newer image for whalebrew/wget:latest docker.io/whalebrew/wget:latest there's already an installation of wget, but there was an error loading the package, err: yaml: invalid trailing UTF-8 octet
$ whalebrew list COMMAND IMAGE
[1]: https://docs.0install.net/basics/first-launch/
https://docs.aws.amazon.com/cli/latest/userguide/install-cli...
If all cli tools were available as officially supported docker images, 'dockerized' would probably not need to exist, other than just a bash function (and something else for windows).
Unfortunately it's not the case, and many tools only come in zipped binaries, or must be compiled.
An alternative approach would have been to make docker images for all cli tools, and publish them. But the burden of maintenance would be quite a bit higher, and it would still be unclear for users which images to use for each cli tool.
With a premade list of cli tools, you won't have to figure out which image to use, write your own Dockerfile if there is no official docker image, how to mount the current directory (try that on windows), which extra volumes to mount (for persistence of npx packages, or .aws credentials, for example), and the 'aliases' will be compatible with unix and windows too.
This tool seemed handy to me, as it was basically a packaged version of what I was already doing with many separate bash scripts. I haven't seen those tools you mentioned, but I'll have a look.
Would this be easy to fix? Like, determining the current user id, and setting it when launching the command? Or would the host uid need to be mapped to the docker uid, which might be different for each image?
https://github.com/nix-community/comma