Skip to content

Latest commit

 

History

25 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

code-playground

Online Compiler made with Docker containers.

Django React Docker

Overview

This project is designed to allow users to write, compile, and execute code in various programming languages directly from their web browser. Its primary goal was to learn more about Docker containers and how a simple remote code execution platform could be created.

Preview

Example of application usage

How it works

To enable users to interact with their programs and receive compilation or runtime errors, this application utilizes WebSocket communication. This communication is based on commands that the client can send to the WebSocket consumer, such as:

  • Start/Stop Code Execution
  • Send Input to the Executing Program

On the backend, each request for code execution results in the creation of a new Docker container from a predefined image (with a separate image for each supported language). Each container has its own handler that tracks its status (e.g., starting, executing, or stopped). The container's output is sent back to the user who initiated the code execution via WebSocket (using a callback mechanism). Additionally, there is a control thread that terminates containers exceeding the allowed execution time. If the number of running containers exceeds the limit, new code execution requests are placed in a queue until resources become available.

Currently, the Docker containers are running without additional isolation layers.To make this actually somewhat secure i would run Docker inside gVisor.

Key points

  • Integrated IDE
  • Live Code Execution (input,output,runtime/compilation errors)
  • WebSocket Communication
  • Container Quantity limitation with queue
  • Container Execution Time limitation

License

MIT

About

Online Compiler made with Docker containers.

Resources

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages