Updating Tunnel Group Port Mappings for DxOdyssey Docker Containers

Applies to…

  • DxOdyssey 19.5 and newer

Summary

Docker does not allow container port mappings to be modified after launch. By using Docker’s commit command, ports can be mapped to an new container with little downtime. These steps are required when additional port mappings are needed for containers running DxOdyssey.

Information

A tunnel origin, whether a single gateway or multiple gateways (.ACTIVE, .PART, etc.), must have a listener on the gateway to function. In Docker, the listening port must be mapped when the container is launched. If the container does not have the correct mapping, the origin will be inoperative on that gateway. A port cannot be mapped to an existing container, but that container can be “committed” and used as the base image for a new container with updated port mappings. Do the following:

  1. Gather information for the container.
    • Execute “docker container ls” on the host machine for the container. This command will list information about all running containers on the machine. Alternatively, executing “docker port < CONTAINER_NAME >” will list port mappings for a specific container. For both commands, the numbers on the left will be the existing mapped ports on the host machine and the number on the right are the corresponding listening ports within the container(s). Note which container ports are already mapped, as these configurations are needed to keep existing origins functional.
    • Execute “docker exec < CONTAINER_NAME > hostname” to get the hostname of the container.
  2. Create a new container with the updated port mappings.
    • Execute “docker stop < CONTAINER_NAME >” to stop the container.
    • Execute “docker commit < CONTAINER_NAME > < NEW_IMAGE_NAME >” using the current container and a new image name to create a new image based on the container.
    • Execute “docker container rm < CONTAINER_NAME >” to remove the old container.
    • Execute “docker run” with the previously configured port mappings for the container, the new port mapping, the same host name, and the newly committed image. The -p flag is for each mapped port, -d runs the container detached so the host machine’s command line is usable after the container is run, and -h specifies the host name used by the container. For example:
    docker run -p 57979:7979 -p 51433:1433 -d -h < HOST_NAME > < NEW_IMAGE_NAME >
  1. After every tunnel group member has been updated with the correct port mappings, make the necessary changes to the tunnel origin using DxCli.

Additional Information