play-with-docker

You know it, you use it, now it's time to improve it. PWD!.

Github星跟踪图

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

Docker 1.13+ is required.

The docker daemon needs to run in swarm mode because PWD uses overlay attachable networks. For that
just run docker swarm init in the destination daemon.

It's also necessary to manually load the IPVS kernel module because as swarms are created in dind,
the daemon won't load it automatically. Run the following command for that purpose: sudo modprobe xt_ipvs

Development

Start the Docker daemon on your machine and run docker pull franela/dind.

  1. Install go 1.7.1+ with brew on Mac or through a package manager.

  2. Install dep and run dep ensure to pull dependencies

  3. Start PWD as a container with docker-compose up.

  4. Point to http://localhost and click "New 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

主要指标

概览
名称与所有者play-with-docker/play-with-docker
主编程语言JavaScript
编程语言Go (语言数: 8)
平台
许可证MIT License
所有者活动
创建于2016-10-08 01:10:47
推送于2025-05-22 02:25:22
最后一次提交2025-05-21 23:25:01
发布数2
最新版本名称v0.0.2 (发布于 )
第一版名称v0.0.1 (发布于 )
用户参与
星数3.1k
关注者数91
派生数741
提交数730
已启用问题?
问题数472
打开的问题数82
拉请求数123
打开的拉请求数19
关闭的拉请求数29
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?