This free online service allows you to run Docker commands in a browser terminal. You can use Docker Playground to:
- Create one or more instances that run Docker Engine
- Run any public or private Docker image from Docker Hub or your own registry
- Upload and download files or Dockerfiles into your instance
Docker Playground is ideal for learning or teaching Docker, experimenting with new features or images, testing your applications, or running workshops and trainings.
How to access Docker Playground
To access Docker Playground, you need to have a web browser and a Docker account to use Docker Playground. You can sign up for a free account on docker.com. Once you have an account, you can sign in with your username and password on Docker labs website.
After you sign in, you will see a dashboard that shows your instances, templates, sessions, and settings.
How to Create a New Instance
An instance is a virtual machine that runs Docker Engine on a Linux operating system. You can create one or more instances on Docker Playground and run Docker commands in a browser terminal.
To create a new instance, you need to click on the ADD NEW INSTANCE button on the dashboard. This will open a new tab with a terminal window that shows the hostname, IP address, and port of your instance. You can also see the expiration time of your instance, which is 4 hours by default.
You can run any Docker command in the terminal window, such as
docker images, and so on. You can also use the + button to open multiple terminals for the same instance.
You can run commands in the terminal for docker, docker-compose and many more.
To delete an instance, you can either use the DELETE button on the dashboard.
How to Access the Docker 101 Tutorial
If you are new to Docker or want to refresh your knowledge, you can access the Docker 101 tutorial on Docker Playground. This is a self-paced interactive tutorial that covers the basics of Docker, such as:
- What are containers and why they are useful
- How to run containers from images and interact with them
- How to build your own images using Dockerfiles
- How to push and pull images from Docker Hub
- How to run multi-container applications using docker-compose
To access the Docker 101 tutorial, you need to run a Docker image that contains the tutorial in your instance. You can do this by using the following command:
docker run -d -p 80:80 docker/getting-started
This will pull and run the docker/getting-started image in your instance and expose port 80. You can then click on the 80 button on the dashboard to open a new tab with the tutorial website.
How to Use Predefined Templates
One of the cool features of Docker Playground is that you can use predefined templates to create a swarm cluster or a Kubernetes cluster in seconds. A swarm cluster is a group of Docker machines that are joined together as a single virtual system. A Kubernetes cluster is a group of nodes that run containerized applications using Kubernetes.
To use predefined templates, you need to click on the TEMPLATES button on the dashboard. This will show you a list of available templates, such as:
- 3 Managers and 2 Workers
- 5 Manager and 0 Workers
- 1 Manager and 1 Worker
You can select any template and click on the CREATE button to create a cluster based on that template. This will open a new tab with multiple terminals that show the details of your cluster nodes. You can also see the expiration time of your cluster, which is 4 hours by default.
You can also use docker compose to deploy applications. For example, you can create a docker compose file with the following config and deploy a WordPress application.
Create a new docker-compose.yml.
Copy the below configuration to the file.
version: "3.9" services: wordpress: container_name: wordpress image: wordpress:php8.2-apache restart: always stdin_open: true tty: true ports: - 80:80 environment: WORDPRESS_DB_HOST: mariadb WORDPRESS_DB_USER: db_user WORDPRESS_DB_PASSWORD: db_user_pass WORDPRESS_DB_NAME: db_name volumes: - wordpress_data:/var/www/html mariadb: container_name: mariadb image: mariadb restart: always environment: MYSQL_DATABASE: db_name MYSQL_USER: db_user MYSQL_PASSWORD: db_user_pass MYSQL_RANDOM_ROOT_PASSWORD: 'root_pass' volumes: - db_data:/var/lib/mysql volumes: db_data: wordpress_data:
:wq to save and exit the editor.
This will pull and run the WordPress and Mariadb images and expose port 80. You can then click on the 80 button on the dashboard to open a new tab with the WordPress website.
How to Use File Upload and Download Features
Another cool feature of Docker Playground is that you can upload and download files or Dockerfiles into your instance by dragging and dropping them into the terminal. This is useful if you want to use your own files or Dockerfiles to build or run your applications.
To upload a file or a Dockerfile into your instance, you need to drag and drop it from your machine into the terminal window. This will upload the file into the current directory of your instance. You can then use the
ls command to see the file in your instance.
In this article, we have learned how to use Docker Playground, a free online service that allows you to run Docker commands in a browser terminal.
Docker Playground is a useful tool for anyone who wants to learn or teach Docker, experiment with new features or images, test their applications, or run workshops and trainings. It is easy to use, fast, and fun.
We hope you enjoyed this article and found it helpful. We encourage you to try out Docker Playground and share your feedback or questions with us. Happy Dockering!
How can I extend the expiration time of my instance or cluster?
You cannot extend the expiration time of your instance or cluster. However, you can save your work by downloading your files or pushing your images before it expires.
You can share your instance or cluster with others by copying and sending the URL of your terminal window.