Scope
This document covers the step required to enter a shell connection to a specific Docker container.
Description
In this example, we will use a Docker exec command to create a connection to a container and then try and ping, by name, the Telos license server. This will confirm that DNS is working and that the container can access the outside world.
Although Docker containers share the same hardware, they each maintain their own "space." For example, if you try to ping something on your network, just because the machine hosting Docker can ping the device doesn't mean the container can also ping it. Containers that use host networking share the host's network, but if the container uses macvlan networking, they are abstracted.
If you are unsure of the configuration, the best way to know for sure is to create a connection directly to the container.
Creating the connection
Find the name of the container
Before creating the connection, we need to determine the container's name. If you already know the container name, you can skip this step.
Connect to the terminal of your docker host. Either with a local KVM or via an SSH session. We'll use SSH in this example.
From the command prompt, run the command
sudo docker container ls
This will list all of the running containers on your system. We're looking for the NAMES column at the far right of the response. In our example, the name we're looking for is iqs-Main.
Create the shell connection to the container
From the command prompt, run the command
sudo docker exec -it >>
In our example, we'll replace<>
with iqs-Main. The full command issudo docker exec -it iqs-Main sh
The response will be a new line with the # (pound or hash sign) for a responseYou are now "inside" the container.
Try pinging your device
If you get a message that ping is not installed, please refer to How to install ping utility in Ubuntu
From the command prompt, run the command
ping google.com
You'll need to press CTRL+C to stop the pingIf DNS is working and your system has access, you should get the response
Try to ping the Telos license server at 173.233.141.18, run the command
ping 173.233.141.18
If you get a positive response then you have a connection to the Telos license server.
Let us know how we can help
If you have further questions on this topic or have ideas about improving this document, please contact us.