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 wish to have more information on the history of containers, Vince, our CSO, wrote an excellent article on our blog
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.
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.
Now that you have your local machine running Docker, we can start with a simple hello world.
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.
You should see something similar too.
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:
If you wish to see the internal network created by the docker engine, you can do so by running the following command.
You will get something similar to this:
If you wish to dig deeper into the network configuration, you can run the following command:
Now that you start your Container, you can stop it using: