Docker Playclouds gives you the experience of having a free Alpine Linux Virtual Machine in the cloud where you can build and run Docker containers and even create clusters with Docker features like Swarm Mode.
Under the hood DIND or Docker-in-Docker is used to give the effect of multiple VMs/PCs.
Original project: Play With Docker
Deploy Docker Playclouds to AWS EC2 with automated setup:
-
Launch EC2 Instance:
- AMI: Amazon Linux 2023 or Ubuntu 22.04
- Instance Type: t3.medium or larger (minimum 2 vCPU, 4GB RAM)
- Storage: 30GB gp3
-
Configure Security Group:
- Port 22 (SSH): 0.0.0.0/0
- Port 80 (HTTP): 0.0.0.0/0
- Port 443 (HTTPS): 0.0.0.0/0
-
Add User Data:
- Copy the contents of
ec2-user-data-updated.sh
- IMPORTANT: Update the
DOMAIN
variable with your domain - Paste into the User Data field during instance launch
- Copy the contents of
-
Configure DNS:
- Point your domain's A record to the EC2 instance public IP
- Wait for DNS propagation (5-30 minutes)
-
Access:
- Navigate to
https://your-domain.com
- Click "Launch" to create a Docker playground session
- Navigate to
For step-by-step manual deployment instructions, see:
π EC2 Deployment Guide - Complete deployment documentation
docker-playclouds/
βββ ec2-user-data-updated.sh # EC2 automated deployment script
βββ EC2-DEPLOYMENT-GUIDE-FINAL.md # Complete EC2 deployment guide
βββ docker-compose.yml # Container orchestration config
βββ Dockerfile.dind # Docker-in-Docker image
βββ haproxy/
β βββ haproxy.cfg # Load balancer configuration
βββ handlers/ # Application handlers
βββ router/ # L2 network router
βββ dockerfiles/ # System container definitions
βββ README.md # This file
Defines three main services:
- haproxy: Load balancer and reverse proxy (ports 80, 443)
- pwd: Main application server (port 3000)
- l2: Network routing layer (ports 8022, 8053)
Important: The pwd service must include -playground-domain YOUR_DOMAIN
parameter.
- SSL/TLS termination
- HTTP to HTTPS redirect
- Backend routing to pwd and l2 services
Automated deployment script that:
- Installs Docker and Docker Compose
- Clones repository
- Applies critical configuration fixes
- Builds DinD image
- Deploys containers
- Verifies deployment
- Docker
18.06.0+
- Go (stable release)
# Clone this repo locally
git clone https://github.com/Tutorials-Dojo/docker-playclouds.git
cd docker-playclouds
# Verify the Docker daemon is running
docker run hello-world
# Load the IPVS kernel module
sudo modprobe xt_ipvs
# Ensure Docker is in swarm mode
docker swarm init
# Build the DinD image
docker build -t local/dind-motd:latest -f Dockerfile.dind .
# Start services
docker-compose up -d
Now navigate to http://localhost:3000 and click "Launch" to create a new session.
For port forwarding to work correctly in development, configure *.localhost
to resolve to 127.0.0.1
:
-
Set up a
dnsmasq
server with this configuration:address=/localhost/127.0.0.1
-
Configure your system DNS to use the dnsmasq server
Aspect | GCP (Container-Optimized OS) | AWS EC2 (Amazon Linux/Ubuntu) |
---|---|---|
Docker | Pre-installed | Manual installation required |
Deployment | Direct docker run | docker-compose |
Configuration | CLI parameters | docker-compose.yml + user data |
When deploying to EC2, ensure:
- β
-playground-domain YOUR_DOMAIN
is set in both pwd command paths (binary and go run) - β
HAProxy exposes both ports:
80:8080
and443:8443
- β
L2 container does not expose port
443:443
(conflicts with HAProxy) - β Security Group allows inbound traffic on ports 22, 80, 443
- β DNS A record points to EC2 public IP
Cause: Playground domain not configured correctly
Fix:
docker exec pwd cat /pwd/sessions | grep domain
# Should show: "domain":"your-domain.com"
# If not, check docker-compose.yml has -playground-domain parameter
Cause: Containers still initializing
Fix: Wait 1-2 minutes for Go compilation and container startup
Cause: Security group not configured
Fix: Ensure AWS Security Group allows ports 80, 443, 22 from 0.0.0.0/0
Cause: Using self-signed certificate or domain mismatch
Fix:
- Production: Use Let's Encrypt certificate
- Testing: Click "Proceed" in browser
Contributions are welcome! Please ensure:
- Code follows existing patterns
- Documentation is updated
- Deployment scripts are tested
This project maintains the same license as the original Play With Docker project.
Use the URL pattern: http://ip<hyphen-ip>-<session_id>-<port>.direct.your-domain.com
Example: http://ip10-0-1-4-8080.direct.dockerlabs.tutorialsdojo.com
No, it needs to run on ports 80/443 for DNS resolution to work correctly. The domain-based routing is essential for the multi-session functionality.
Sessions last for 15 minutes by default (900 seconds). This can be configured in the playground settings.
Last Updated: October 2025 Tested On: Amazon Linux 2023, Ubuntu 22.04