Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

Commit

Permalink
Generic container runner, for quick $PWD:/tmp/workdir
Browse files Browse the repository at this point in the history
Cannot re-use the `--image` flag, due to skybet/cali#55
  • Loading branch information
Lucy Davinhart committed Aug 25, 2019
1 parent 415e5f4 commit 6c6d63a
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.15.0

* Generic container runner, for quick $PWD:/tmp/workdir

## 0.14.1

* Fix panic when running `lucli terraform` with no args
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.14.1
0.15.0
37 changes: 37 additions & 0 deletions cmd/generic.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package cmd

import (
log "github.com/Sirupsen/logrus"
"github.com/skybet/cali"
)

func init() {

command := cli.NewCommand("generic [params]")
command.SetShort("Very basic generic Container Runner")
command.SetLong(`Runs containers as simply as possible.
This is basically the equivalent of:
docker run --rm -it -w /tmp/workdir -v $PWD:/tmp/workdir <image> "$@"
i.e. not particularly useful for much beyond simply testing an image.
Many images will require additional docker run parameters (and thus custom commands)
`)

// Empty string for now. Image will be set during Init
task := command.Task("")

// Flag to specify which image to use
command.Flags().StringP("docker-image", "i", "centos:7", "Image to use")
command.Flags().StringP("entrypoint", "e", "sh", "entrypoint to use")
command.BindFlags()

task.SetInitFunc(func(t *cali.Task, args []string) {
// Select the image to use
image := cli.FlagValues().GetString("docker-image")
log.Infof("Using image: %s", image)
t.SetImage(image)
})

}

0 comments on commit 6c6d63a

Please sign in to comment.