Skip to main content

What is Docker?

At Edgegap, we are working with containers to distribute the load evenly across the globe. We need to have your game started up within milliseconds; the containers need to be built with speed in mind. We will walk you through the creation of a docker image, also known as a container.

If you wish to have more information on the history of containers, Math our CEO wrote an excellent article on our blog

img

What is Docker?

  • Docker is a PaaS (Platform as a Service) that allows OS-level virtualization.

What is the Docker Run command?

  • 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 that 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 by doing 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.

  1. Download the Container from the Edgegap Repository (Only the first time)
  2. Start the Container 
  3. The name will be speedtest (--name)
  4. 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 expose 80 in the Container (-p)
  5. You can try it by going on your Web browser and hit http://localhost
  6. Voila, you have run your first Container. 

Now that you have your Container running, you can interact with it, in the next session, we will restart the Container stop the Container and see the network is connected to, first of all, you will need to see what is running on your docker-engine locally 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.

This 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 that was 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 do so by running 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