What is Docker?
At Edgegap, we work with containers to distribute the load evenly across the globe. We need to have your game started within milliseconds, so the containers need to have speed in mind and build accordingly. We will walk you through creating a docker image, also known as a container.
If you want to familiarize yourself with container quickly, we strongly recommend this quick video.
What is Docker?
- Docker is a PaaS (Platform as a Service) that allows OS-level virtualization.
What is the Docker Run command?
- The docker run command allows a container to be created from an image so that the Docker desktop engine can run the Container.
Give it a try
Let's start by adding the tools you will need on your computer to create your first Container.
You can follow the installation procedure as stated on Docker desktop.
if you are running Windows 10 Pro
If you are running Windows 10 Home Edition
If you are running macOS
Now that you have your local machine running Docker, we can start with a simple hello world.
docker run -d -p 80:80 --name speedtest edgegap/speedtest-edge
You can go to your command prompt and type the command above.
The steps will proceed automatically.
- Download the Container from the Edgegap Repository (Only the first time)
- Start the Container
- The name will be speedtest (--name)
- To expose your Container, you need to do it in the docker run command. In this example, we will expose port 80 on the outside, pointing to the exposed 80 in the Container (-p)
- You can try it by going on your Web browser and hitting http://localhost
- Voila, you have run your first Container.
Now that you have your Container running, you can interact with it. We will restart the Container, stop it, and see its network in the next session. First, you will need to locally see what is running on your docker-engine at the command line type.
docker ps
You should see something similar too.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
dbf4d3734111 edgegap/speedtest-edge "docker-php-entrypoi…" 29 minutes ago Up 29 minutes 0.0.0.0:80->80/tcp speedtest
You visually see the Container information running on your computer; you can have more than one running on this list.
docker ps
is a simple command; you will learn to use it a lot.
Let's say that you need to have more information about your running container. You can ask the docker engine to give you all the details about your Container by running the following command:
docker container inspect speedtest
If you wish to see the internal network created by the docker engine, you can do so by running the following command.
docker network ls
You will get something similar to this:
NETWORK ID NAME DRIVER SCOPE
67b24038b9ca bridge bridge local
6f7fe43a489d host host local
3d80cdb86a7e none null local
If you wish to dig deeper into the network configuration, you can run the following command:
docker network inspect 67b24038b9ca
# where 678b24038b9ca is your network connected to your Container
Docker Stop
Now that you start your Container, you can stop it using:
docker container stop speedtest