How To Add A “Try In Play-With-Docker” Button To Your Github Project
I was inspired by the great experience I had when evaluating a repository on GitHub, because it had a Play-With-Docker button that allowed me to instantly spin up all the containers necessary to run the project, and see if it fits my needs.
What Is PWD (Play-With-Docker)?
PWD is a service that provides you with a temporary private Docker environment inside your browser.
For a period of 4 hours, you can pull, build, run and interact with as many Docker containers as you wish.
It is one of the best projects I know that utilise Docker in Docker technology.
How Does It Look Like?
See for yourself how PWD pulls and runs 6 containers over 3 networks in 25 seconds:
Giving this level of immediacy to potential open-source project contributors can increase the rate of community involvement in any project.
In today’s open-source “market” where there is an abundant supply of projects that can use a helping hand, and a scarcity of good developers with spare time, hacks like this become extremely valuable.
How To Add The “Try in PWD” Button
It’s quite simple actually. Insert the following Markdown to your README.md file:
[![Try in PWD](https://raw.githubusercontent.com/play-with-docker/stacks/master/assets/images/button.png)](https://labs.play-with-docker.com/?stack=https://raw.githubusercontent.com/vegasbrianc/prometheus/version-2/pwd-stack.yml)
All you need to do is change the link in bold to a docker-compose.yml file that spins up the environment needed to test run your project.
In the docker-compose.yml file you can either reference docker images hosted on a public docker repository (e.g. Docker Hub), or a remote git repository with a Dockerfile that will be built on demand:
If you used this quick how-to to add the “Try in PWD” button to a project, please let me know in the comments!
Subscribe for updates, clap for serotonin, and say hi on Twitter or the streets of Tel Aviv