{"id":13448989,"url":"https://github.com/codetainerapp/codetainer","last_synced_at":"2025-04-13T00:49:38.695Z","repository":{"id":144202168,"uuid":"38206506","full_name":"codetainerapp/codetainer","owner":"codetainerapp","description":"A Docker container in your browser.","archived":false,"fork":false,"pushed_at":"2018-05-09T09:11:55.000Z","size":23296,"stargazers_count":1059,"open_issues_count":16,"forks_count":107,"subscribers_count":71,"default_branch":"master","last_synced_at":"2025-04-13T00:49:28.049Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codetainerapp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-06-28T16:53:56.000Z","updated_at":"2025-03-23T03:04:48.000Z","dependencies_parsed_at":"2023-06-26T02:02:53.856Z","dependency_job_id":null,"html_url":"https://github.com/codetainerapp/codetainer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codetainerapp%2Fcodetainer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codetainerapp%2Fcodetainer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codetainerapp%2Fcodetainer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codetainerapp%2Fcodetainer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codetainerapp","download_url":"https://codeload.github.com/codetainerapp/codetainer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650436,"owners_count":21139672,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T06:00:27.353Z","updated_at":"2025-04-13T00:49:38.670Z","avatar_url":"https://github.com/codetainerapp.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# codetainer\n\n![codetainer gif](codetainer.gif?raw=true)\n\n[![Build Status](http://komanda.io:8080/api/badge/github.com/codetainerapp/codetainer/status.svg?branch=master)](http://komanda.io:8080/github.com/codetainerapp/codetainer)\n\n`codetainer` allows you to create code 'sandboxes' you can embed in your \nweb applications (think of it like an OSS clone of [codepicnic.com](http://codepicnic.com)).\n\nCodetainer runs as a webservice and provides APIs to create, view, and attach to the \nsandbox along with a nifty HTML terminal you can interact with the sandbox in \nrealtime. It uses Docker and its introspection APIs to provide the majority\nof this functionality.\n\nCodetainer is written in Go.\n\nFor more information, see [the slides from a talk introduction](https://www.slideshare.net/JenAndre/codetainer-a-browser-code-sandbox).\n\n# Build \u0026 Installation\n\n## Requirements\n\n  * Docker \u003e=1.8 (required for file upload API)\n  * Go \u003e=1.4\n  * [godep](https://github.com/tools/godep)\n\n### Building \u0026 Installing From Source \n\n```bash\n# set your $GOPATH\ngo get github.com/codetainerapp/codetainer  \n# you may get errors about not compiling due to Asset missing, it's ok. bindata.go needs to be created\n# by `go generate` first.\ncd $GOPATH/src/github.com/codetainerapp/codetainer\n# make install_deps  # if you need the dependencies like godep\nmake\n```\n\nThis will create ./bin/codetainer.\n\n## Configuring Docker\n\nYou must configure Docker to listen on a TCP port.\n\n```\nDOCKER_OPTS=\"-H tcp://127.0.0.1:4500 -H unix:///var/run/docker.sock\"\n```\n\n## Configuring codetainer\n\nSee ~/.codetainer/config.toml.  This file will get auto-generated the first \ntime you run codetainer, please edit defaults as appropriate.\n\n```toml\n# Docker API server and port\nDockerServer = \"localhost\"\nDockerPort = 4500\n\n# Enable TLS support (optional, if you access to Docker API over HTTPS)\n# DockerServerUseHttps = true\n# Certificate directory path (optional)\n#   e.g. if you use Docker Machine: \"~/.docker/machine/certs\"\n# DockerCertPath = \"/path/to/certs\"\n\n# Database path (optional, default is ~/.codetainer/codetainer.db)\n# DatabasePath = \"/path/to/codetainer.db\"\n```\n\n## Running an example codetainer\n\n```bash\n$ sudo docker pull ubuntu:14.04\n$ codetainer image register ubuntu:14.04\n$ codetainer create ubuntu:14.04 my-codetainer-name\n$ codetainer server  # to start the API server on port 3000\n```\n\n### Embedding a codetainer in your web app \n\n 1. Copy [codetainer.js](web/public/javascript/codetainer.js) to your webapp. \n 2. Include `codetainer.js` and `jquery` in your web page. Create a div\nto house the codetainer terminal iframe (it's `#terminal` in the example below).\n\n ```html \n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003cmeta charset=\"UTF-8\"\u003e\n    \u003ctitle\u003elsof tutorial\u003c/title\u003e\n    \u003clink rel='stylesheet' href='/stylesheets/style.css' /\u003e\n    \u003cscript src=\"http://code.jquery.com/jquery-1.10.1.min.js\"\u003e\u003c/script\u003e\n    \u003cscript src=\"/javascripts/codetainer.js\"\u003e\u003c/script\u003e\n    \u003cscript src=\"/javascripts/lsof.js\"\u003e\u003c/script\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n     \u003cdiv id=\"terminal\" data-container=\"YOUR CODETAINER ID HERE\"\u003e \n  \u003c/body\u003e\n\u003c/html\u003e \n ```\n\n 3. Run the javascript to load the codetainer iframe from the \ncodetainer API server (supply `data-container` as the id of codetainer on \nthe div, or supply `codetainer` in the constructor options).\n\n```js \n $('#terminal').codetainer({\n     terminalOnly: false,                 // set to true to show only a terminal window \n     url: \"http://127.0.0.1:3000\",        // replace with codetainer server URL\n     container: \"YOUR CONTAINER ID HERE\",\n     width: \"100%\",\n     height: \"100%\",\n  });\n```\n\n### API Documentation\n\n*TODO*\n\n### Profiles\n\n*TODO* more documentation.\n\nYou can use profiles to apply Docker configs to limit CPU, memory, network access,\nand more.\n\nSee [example profiles](example-profiles) for some examples of this.\n\nRegister a profile to use with codetainer using `codetainer profile register \u003cpath-to-json\u003e \u003cname of profile\u003e`\nand then supply `codetainer-config-id` when POST'ing to `/api/v1/codetainer` to create.\n\n# Status\n\nCodetainer is unstable and in active development.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodetainerapp%2Fcodetainer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodetainerapp%2Fcodetainer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodetainerapp%2Fcodetainer/lists"}