Creating a Container with Tunnel Origins
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 Containers.
Information
Docker requires that all container ports are mapped at startup. To add an origin to a new container:
-
Obtain a One-Time Passkey from an existing member of the cluster or gateway group by executing
dxcli set-otpk
. -
Create a new container from one of the DH2i images (
dh2i/dxe
,dh2i/dxo
,dh2i/dxemssql
) by executing thedocker 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 dxovol:/etc/dh2i -h <CONTAINER_HOSTNAME> --name <CONTAINER_NAME> <IMAGE_NAME>
-
Join the node or gateway to the cluster or gateway group by executing
docker exec <CONTAINER_NAME> dxcli join-cluster-ex
ordocker exec <CONTAINER_NAME> dxcli join-gateway-group-ex
. More information on these commands can be found in the DxCLI guide for DxEnterprise or DxOdyssey. -
Add the new node or gateway as an origin to the tunnel by executing
docker exec <CONTAINER_NAME> dxcli add-tunnel
with parameters that utilize the Docker port mapping. More information on this command can be found in the DxCLI guide for DxEnterprise or DxOdyssey.