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
Container runtimes require that all container ports are mapped at startup. To add a tunnel 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, ordh2i/dxemssql) using your container runtime.
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 container name.
- Docker
- Podman
docker run \
-p 7979:7979 \
-p <ORIGIN_PORT_MAPPING> \
-d \
-v dxovol:/etc/dh2i \
-h <CONTAINER_HOSTNAME> \
--name <CONTAINER_NAME> \
<IMAGE_NAME>
podman run \
-p 7979:7979 \
-p <ORIGIN_PORT_MAPPING> \
-d \
-v dxovol:/etc/dh2i \
-h <CONTAINER_HOSTNAME> \
--name <CONTAINER_NAME> \
docker.io/<IMAGE_NAME>
- Join the node or gateway to the cluster or gateway group using the appropriate DxCLI command.
- Docker
- Podman
For DxEnterprise, run:
docker exec <CONTAINER_NAME> dxcli join-cluster-ex
For DxOdyssey, run:
docker exec <CONTAINER_NAME> dxcli join-gateway-group-ex
For DxEnterprise, run:
podman exec <CONTAINER_NAME> dxcli join-cluster-ex
For DxOdyssey, run:
podman exec <CONTAINER_NAME> dxcli join-gateway-group-ex
More information on these commands can be found in the DxCLI guides for DxEnterprise and DxOdyssey.
- Add the new node or gateway as a tunnel origin using the mapped container ports.
- Docker
- Podman
docker exec <CONTAINER_NAME> dxcli add-tunnel <parameters>
podman exec <CONTAINER_NAME> dxcli add-tunnel <parameters>
More information on these commands can be found in the DxCLI guides for DxEnterprise and DxOdyssey.