Skip to main content
Version: Archive

Adding a Tunnel Origin to a Docker Container

Summary

Tunnel origins must be mapped at container runtime. This article covers creating a new container with port mappings for an origin. To modify port mappings for an existing container, see Updating Port Mappings for Docker Containers Using Docker Commit.

Information

Docker requires that all container ports are mapped at startup. To add an origin to a new container:

  1. Obtain a one-time passkey from an existing member of the gateway group by executing dxcli set-otpk.

  2. Create a new container from the DH2i base image by executing the docker run command. The -p flags specify each mapped port, -d runs the container detached, -v creates a new volume mount for /etc/dh2i, -h specifies the hostname used by the container, and --name specifies the name the Docker host will use for the container. For example:

    docker run -p 7979:7979 -p <ORIGIN_PORT_MAPPING> -d -v dxoVolume:/etc/dh2i -h <CONTAINER_HOSTNAME> --name <CONTAINER_NAME> dh2i/dxo
  3. Start a new shell in the container by executing docker exec -it <CONTAINER_NAME> bash

  4. Join the gateway to the gateway group by executing dxcli join-gateway-group, follow the prompts and supply the one-time passkey created in the previous step.

  5. Add the new gateway as an origin to the tunnel by executing dxcli add-tunnel with parameters that utilize the Docker port mapping.

Additional information