# Create a code sandbox with docker-run

How to create a simple web page that let's you run python code (or any other language) from the browser:
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1609513903553/mZuY4WZLF.png)

These instructions are for ubuntu 20.10, but should be similar for other linux distros.

#### Install docker-run
[Docker-run](https://github.com/glotcode/docker-run) will be used to run the code.
Follow the [instructions to install docker-run](https://github.com/glotcode/docker-run/blob/main/docs/install/ubuntu-20.10.md).
Make sure you pull the python image:
```
docker pull glot/python:latest
```

#### Install nginx
Nginx will be used to host the web page
 
```bash
apt install nginx
```

#### Add a new site to nginx
```bash
curl https://gist.githubusercontent.com/prasmussen/5b1e2a42b295316dd8b1f665fa8589a7/raw/23811a690a7ce446e43c55f37d331403ec91994a/code-sandbox.conf > /etc/nginx/sites-enabled/code-sandbox
```

#### Restart nginx to enable the new site
```bash
systemctl restart nginx.service
```

#### Add the web page
```bash
mkdir /home/glot/www
curl https://gist.githubusercontent.com/prasmussen/5b1e2a42b295316dd8b1f665fa8589a7/raw/23811a690a7ce446e43c55f37d331403ec91994a/index.html > /home/glot/www/index.html
```

Edit `/home/glot/www/index.html` and change token in the `X-Access-Token` header to the token you configured when installing docker-run.


Your code sandbox should now be available at `http://<your ip>:8000`.

Please read the [security section](https://github.com/glotcode/docker-run#security) before making your web page available on the internet. Good luck!

