Command to easily run things in docker containers, with simple parameters and automatic cleanup.
You can read an introductory blog post here.
Head to the releases page and download the latest version for your system, adding it to your PATH.
Usage:
dockerit [image]
dockerit [image] [command]
dockerit [flags] [image] [command] -- [command flags]
Flags:
--entry Use the default entrypoint. If entry=0 you must provide one (default true)
-e, --env stringArray Set environment variables
-h, --help help for dockerit
--home Mount the home directory of the user
--magic Magically use magic settings based on the image being used
--me User override for the command, runs as current user
--port string Port mapping <host>:<container> eg. 8080:80
--pull Pull the docker image even if present
--pwd Mount the PWD into the container (and set as working directory /pwd)
--selfupdate Update this command to the latest release from GitHub
--user string User override for the command
-v, --verbose verbose output
--version version information
# composer
alias composer1='dockerit --magic composer:1 -- composer'
alias composer2='dockerit --magic composer:2 -- composer'
alias composer='composer2'
# npm
alias npm='dockerit --magic node -- npm'Output help information:
dockerit --helpRun an interactive shell in the latest php image:
dockerit php -- -aSome images have a default set of options configured which can be used with --magic:
dockerit --magic composer:1 infoYou can also choose your own option set for the composer version 1 info command. Example: Mounth and u the current working directory as the current user with their home dir mounted and set as the composer home:
dockerit --me --pwd --home --env COMPOSER_HOME=~/.composer composer:1 infoRun an bash in the latest ubuntu image (overriding default point):
dockerit --entry=0 --user=root ubuntu bashRun nginx as the container user and expose it on port 8080:
dockerit --port=8080:80 nginxRun git in the current working directory as the current user with their home dir mounted:
dockerit --me --pwd --home git config -- --listRun a command in an image with verbose mode turned on:
dockerit --verbose [image] [command]go mod vendorThere is a shortcut to help you:
./devBuilt using https://github.com/laher/goxc and a Makefile
go get github.com/laher/goxcThen build...
make buildIf you want to build with a specific version number / name:
VERSION=0.0.0 make buildThe build directory will be populated with the release.