MCPcopy
hub / github.com/play-with-docker/play-with-docker

github.com/play-with-docker/play-with-docker @v0.0.2 sqlite

repository ↗ · DeepWiki ↗ · release v0.0.2 ↗
819 symbols 2,384 edges 94 files 2 documented · 0%
README

play-with-docker

Play With Docker 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.

A live version is available at: http://play-with-docker.com/

Requirements

Development

# Clone this repo locally
git clone https://github.com/play-with-docker/play-with-docker
cd play-with-docker

# Verify the Docker daemon is running
docker run hello-world

# Load the IPVS kernel module. Because swarms are created in dind,
# the daemon won't load it automatically
sudo modprobe xt_ipvs

# Ensure Docker daemon is running in swarm mode
docker swarm init

# Get the latest franela/dind image
docker pull franela/dind

# Optional (with go1.14): pre-fetch module requirements into vendor
# so that no network requests are required within the containers.
# The module cache is retained in the pwd and l2 containers so the
# download is a one-off if you omit this step.
go mod vendor

# Start PWD as a container
docker-compose up

Now navigate to http://localhost and click the green "Start" button to create a new session, followed by "ADD NEW INSTANCE" to launch a new terminal instance.

Notes:

  • There is a hard-coded limit to 5 Docker playgrounds per session. After 4 hours sessions are deleted.
  • If you want to override the DIND version or image then set the environmental variable i.e. DIND_IMAGE=franela/docker<version>-rc:dind. Take into account that you can't use standard dind images, only franela ones work.

Port forwarding

In order for port forwarding to work correctly in development you need to make *.localhost to resolve to 127.0.0.1. That way when you try to access to pwd10-0-0-1-8080.host1.localhost, then you're forwarded correctly to your local PWD server.

You can achieve this by setting up a dnsmasq server (you can run it in a docker container also) and adding the following configuration:

address=/localhost/127.0.0.1

Don't forget to change your computer default DNS to use the dnsmasq server to resolve.

FAQ

How can I connect to a published port from the outside world?

If you need to access your services from outside, use the following URL pattern http://ip<hyphen-ip>-<session_jd>-<port>.direct.labs.play-with-docker.com (i.e: http://ip-2-135-3-b8ir6vbg5vr00095iil0-8080.direct.labs.play-with-docker.com).

Why is PWD running in ports 80 and 443?, Can I change that?.

No, it needs to run on those ports for DNS resolve to work. Ideas or suggestions about how to improve this are welcome

Extension points exported contracts — how you extend this code

Task (Interface)
(no doc) [7 implementers]
scheduler/scheduler.go
InstanceProvisionerApi (Interface)
(no doc) [4 implementers]
provisioner/provisioner.go
StorageApi (Interface)
(no doc) [2 implementers]
storage/storage.go
PWDApi (Interface)
(no doc) [2 implementers]
pwd/pwd.go
DockerApi (Interface)
(no doc) [2 implementers]
docker/docker.go
Generator (Interface)
(no doc) [2 implementers]
id/generator.go
EventApi (Interface)
(no doc) [2 implementers]
event/event.go
FactoryApi (Interface)
(no doc)
k8s/factory.go

Core symbols most depended-on inside this repo

On
called by 92
event/mock.go
Name
called by 62
scheduler/scheduler.go
On
called by 57
event/event.go
String
called by 54
event/event.go
Get
called by 49
k8s/factory.go
r
called by 38
www/assets/xterm/xterm.js
Close
called by 38
router/router.go
save
called by 28
storage/file.go

Shape

Method 397
Function 327
Struct 76
Interface 12
FuncType 4
TypeAlias 3

Languages

Go79%
TypeScript21%

Modules by API surface

www/assets/xterm/xterm.js106 symbols
docker/docker.go57 symbols
pwd/pwd.go37 symbols
docker/mock.go35 symbols
storage/file.go32 symbols
pwd/mock.go30 symbols
storage/storage.go29 symbols
storage/mock.go28 symbols
www/assets/app.js24 symbols
scheduler/scheduler.go23 symbols
handlers/terms.go20 symbols
storage/file_test.go18 symbols

Dependencies from manifests, versioned

cloud.google.com/gov0.58.0 · 1×
docker.io/go-dockerv1.0.0 · 1×
github.com/Microsoft/go-winiov0.4.5 · 1×
github.com/PuerkitoBio/purellv1.1.0 · 1×
github.com/PuerkitoBio/urlescv0.0.0-2017081014372 · 1×
github.com/aws/aws-sdk-gov1.12.15 · 1×
github.com/beorn7/perksv0.0.0-2016080410472 · 1×
github.com/docker/distributionv2.6.0-rc.1.0.201707 · 1×
github.com/docker/dockerv1.4.2-0.20200309214 · 1×
github.com/docker/go-connectionsv0.3.0 · 1×
github.com/docker/go-unitsv0.3.2 · 1×

For agents

$ claude mcp add play-with-docker \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact