codetainer
allows you to create code 'sandboxes' you can embed in your
web applications (think of it like an OSS clone of codepicnic.com).
Codetainer runs as a webservice and provides APIs to create, view, and attach to the sandbox along with a nifty HTML terminal you can interact with the sandbox in realtime. It uses Docker and its introspection APIs to provide the majority of this functionality.
Codetainer is written in Go.
- Docker >=1.8 (required for file upload API)
- Go >=1.4
- godep
# set your $GOPATH
go get github.com/codetainerapp/codetainer
cd $GOPATH/src/github.com/codetainerapp/codetainer
# make install_deps # if you need the dependencies like godep
make
This will create ./bin/codetainer.
You must configure Docker to listen on a TCP port.
DOCKER_OPTS="-H tcp://127.0.0.1:4500 -H unix:///var/run/docker.sock"
See config.toml.
vagrant@vagrant-ubuntu-trusty-64:/opt/dev/codetainer$ more config.toml
# Docker API server and port
DockerServer = "localhost"
DockerPort = 4500
# Database path
DatabasePath = "/home/vagrant/codetainer.db"
./bin/codetainer image register ubuntu:14.04
./bin/codetainer create ubuntu:14.04 my-codetainer-name
./bin/codetainer server # to start the API server