This is a simple CLI to run a container and selective commands with Docker.
The primary purpose for this tool is to help create a consistent development experience.
- Currently this will mount the directory you are executing from to
/app
on the container- This is useful for building projects locally
- This is my first Go project, so there's room for improvement
- Download binary from releases
- Move the binary to
/usr/local/bin/drun
mv drun-[arch] /usr/loca/bin/drun
chmod +x /usr/local/bin/drun
go get github.com/rgoomar/drun
cd $GOPATH/src/github.com/rgoomar/drun
# if you want to use $GOPATH/bin
go install
# if you want it to be local to the directory
go build
You can add a drun.json
file in the root of your project or wherever you going to run it.
Config Options
image
- Specify Docker image
defaultCommand
- Default command to run
net
- Network Mode for docker run. Defaults to host
for running local servers.
ports
- Ports you want to expose, defaults to all ports on container
Example
{
"image": "openjdk:8",
"defaultCommand": "./gradlew build",
"net": "host",
"ports": {
"8080":"8080",
"5000":"5000"
}
}
--image
- Specify an image to run
--net
- Specify a network mode
[COMMANDS]
- Commands to execute in container
With this configuration:
{
"image": "openjdk:8",
"defaultCommand": "./gradlew build"
}
You can run:
drun
With this configuration:
{
"image": "openjdk:8",
"defaultCommand": "./gradlew build"
}
You can run:
drun ./gradlew build
drun --image node:8-alpine node --version