Benefits of Docker Containers

GNS3 also supports Docker containers, which allow you to run hosts on your GNS3 project with low CPU and memory resource consumption. You can use VPCS as a host, but VPCS has some functional limitations.

This page explains how to add a Linux (Alpine Linux) host for a Docker container. It will be easier to do various verifications using a lightweight Linux host.

Steps to add Docker containers

The steps to add a Docker container Linux host are as follows

  1. Creating a container template(Alpine Linux)
  2. Add a Docker container host to the project
  3. Host network configuration

Please note that this page is based on the following environment.

Host OSWindows10 Pro
GNS3 version2.2.17
GNS3 VM version2.2.17
Virtualization hypervisorVMware Workstation 16.6.2

Creating a container template(Alpine Linux)

First, create a Docker container template for Alpine Linux. On GNS3, go to [Edit] > [Preferences] > [Docker Containers] and click [New].

Select [Run this Docker container on the GNS3 VM] and click [Next].

Select [New Image], enter “alpine:latest” in Image name, and click [Next].

Then, enter a display name for the container and click [Next].

Then, decide the number of network interfaces (Adapters) for the host, and click [Next].

Enter the command to be executed at startup. Enter “sh” to start a shell.

Specify the console type. For normal CLI, you can leave the default “telnet”.

You can specify environment variables if necessary. Click [Finish] to finish creating the template.

Add a Docker container host to the project

Once you have created a template of the Docker container for Alpine Linux, it will appear in the [End Device] toolbar.

Drag and drop the Alpine Linux template onto your workspace. The docker pull command will automatically download the container image of the template from Docker Hub to the GNS3 VM. The container image will be downloaded only for the first time, and the log of executing docker pull command will be displayed on the console of GNS3.

After that, you just need to set up a link between your router or other devices and the Linux host of the Docker container.

You can then launch the container and double-click the icon to access the CLI.

Host network configuration

To configure the network configuration, edit the file “/etc/network/interfaces”. You can edit it from the CLI of Alpine Linux, but you can also edit it on GNS3 by right-clicking on the icon placed in the workspace and clicking [Edit Config].

Link

The following web site is very helpful for understanding the network configuration of Alpine Linux.