Skip to main content

How to configure Docker template preferences

Docker is a node type in GNS3 based on container technology. Unlike QEMU/Dynamips virtual machines, Docker shares the host machine kernel. It starts very fast.

Create a Template

This example uses an Ubuntu container to show how to create a Docker template.

  1. Click the "Docker" option to enter.

    Enter Docker
  2. Click the + button at the top right to add a new template.

    Click add
  3. Follow the wizard steps. Click "Docker Virtual Machine".

    Wizard start
  4. If the image already exists, choose "Existing image" and select it from the list. Then click "Container name".

    Choose existing image
  5. If the image does not exist, choose "New image". Enter the image name in "Image name" (e.g. ubuntu:latest). Then click "Container name".

    Enter new image
  6. In "Container name", enter the container template name. Then click "Network adapters".

    Container name
  7. In "Network adapters", set the number of interfaces. Then click "Start command".

    Network adapters
  8. In "Start command", enter the startup parameters. Then click "Console type".

    Start command
  9. Choose the console type based on the container type (telnet/vnc, etc.). Then click "Auxiliary console type".

    Console type
  10. Set "Auxiliary console type" to "None". Then click "Environment".

    Auxiliary console
  11. In "Environment", set the container environment variables. Then click "Add Template" to finish.

    Environment variables
  12. After creation, you can see the new template in the list.

    Creation done
  13. Click the three-dot button on the right to choose Delete, Copy, or Edit.

    Action menu

Differences from Other Node Types

FeatureDockerQEMUDynamipsVPCS
Technology typeContainer (shared kernel)Full virtualizationHardware simulationSimulated PC
Startup speedVery fast (seconds)Slow (minutes)SlowFast
Image sizeSmall (layered storage)Large (several GB)MediumVery small
Number of NICs0-1000-275Depends on platform1
Console types8 types7 typestelnet/sshtelnet
Memory limitOptional (0 = no limit)RequiredRequiredNone
CPU limitOptional (supports decimals)RequiredRequiredNone

Docker Template Configuration Details

General Settings

FieldTypeUnitUse
Template nameText--Name of the template, shown in the list
Default name formatText--Auto-naming format for instances, e.g. {name}-{0}
ImageText--Docker image name (e.g. ubuntu:latest)
CategoryDropdown--Device category
SymbolText + button--Topology icon
TagsChip input--Tags for sorting/filtering
AdaptersNumbercountNumber of network adapters, default is 0
Base MACText--Base MAC address, leave empty for auto-generation
Maximum memoryNumberMBMemory limit, 0 = no limit
Maximum CPUsNumbercountCPU core limit, 0 = no limit
Console typeDropdown--telnet / ssh / vnc / http / https / none
Auxiliary console typeDropdown--Auxiliary console type
VNC console resolutionDropdown--VNC resolution, only works when console_type is vnc
HTTP port in the containerNumber--HTTP port number inside the container
HTTP pathText--HTTP path, e.g. /, /gui
Auto start consoleCheckbox--Automatically opens the console when enabled
Edit network configurationButton--Customize NIC MAC addresses
General settings

Custom Network Configuration

Click "Edit network configuration" to open the dialog. One NIC per row:

ColumnField typeUse
AdapterRead-only labelNIC number, auto-increment
Port nameRead-only textPort name, fixed as eth0, eth1... (Docker convention)
MAC addressText inputMAC address, can be customized. Leave empty for auto-generation
ActionDelete buttonDelete this NIC
Custom network

Advanced Settings

Start Command

FieldTypeUse
Start commandText areaContainer startup command. Overrides the Docker image default CMD

Environment

FieldTypeUse
EnvironmentText areaEnvironment variables, one per line, format KEY=VALUE. Supports template variables: %vm-name%, %vm-id%, %project-id%, %project-path%

Example:

DB_HOST=192.168.1.10
DB_PORT=5432
API_KEY=%vm-id%
PROJECT=%project-id%

Extra Volumes

FieldTypeUse
Extra volumesText areaExtra mounted volumes. One container directory path per line. Data is not lost when the container is deleted

Example:

/data
/config
/var/log/app

Extra Hosts

FieldTypeUse
Extra hostsText areaExtra hostname mappings. One per line, format hostname:IP

Example:

gns3.local:192.168.100.10
database.internal:10.0.0.5
api.example.com:172.16.0.100
Advanced settings