On the host, you can install a {{page.netscaler-cpx-short}} instance in the Docker container by using the {{page.netscaler-cpx-short}} Docker image that you loaded onto the host. Using the docker run command, install the {{page.netscaler-cpx-short}} instance with the default {{page.netscaler-cpx-short}} configuration.
Install the {{page.netscaler-cpx-short}} instance on the Docker container by using the following docker run command:
docker run -dt -P --privileged=true --net=host –e NS_NETMODE=”HOST” -e CPX_CORES=<number of cores> --name <container_name> --ulimit core=-1 -e CPX_NW_DEV='<INTERFACES>' -e CPX_CONFIG=’{“YIELD”:”NO”}’ -e LS_IP=<LS_IP_ADDRESS> -e LS_PORT=<LS_PORT> e PLATFORM=CP1000 -v <host_dir>:/cpx <REPOSITORY>:<TAG>docker run -dt --privileged=true --net=host -e NS_NETMODE="HOST" -e CPX_NW_DEV='eth1 eth2' -e CPX_CORES=5 –e CPX_CONFIG='{"YIELD":"No"}' -e LS_IP=10.102.38.134 -e PLATFORM=CP1000 -v /var/cpx:/cpx --name cpx_host cpx:12.1-48.xx
This example creates a container named mycpx based on the {{page.netscaler-cpx-short}} Docker image.
The -P parameter is mandatory. It tells Docker to map the ports exposed in the container by the {{page.netscaler-cpx-short}} Docker image. That means map ports 9080, 22, 9443, and 161/UDP, to the ports on the Docker host that are randomly selected from the user defined range. This mapping is done to avoid conflicts. If you later create multiple {{page.netscaler-cpx-short}} containers on the same Docker host. The port mappings are dynamic and are set each time the container is started or restarted. The ports are used as follows:
If you want static port mappings, use the -p parameter to set them manually.
The --privileged=true option is used to run the container in privileged mode. If you are running the {{page.netscaler-cpx-short}} with multiple cores then you need to provide all the system privileges to the {{page.netscaler-cpx-short}}. If you want to run the {{page.netscaler-cpx-short}} with a single core then instead of this option you must use the --cap-add=NET_ADMIN option. The --cap-add=NET_ADMIN option enables you to run the {{page.netscaler-cpx-short}} container with full network privileges.
The**--net=host is a standard docker run command option that specifies that the container is running in the host network stack and has access to all the network devices.
If you are running {{page.netscaler-cpx-short}} in bridge or none network, ignore this option.
The -e NS_NETMODE="HOST" is a {{page.netscaler-cpx-short}} specific environment variable that allows you to specify that the {{page.netscaler-cpx-short}} is started in host mode. Once {{page.netscaler-cpx-short}} starts in host mode it configures four default iptable rules on the host machine for management access to the {{page.netscaler-cpx-short}}. It uses the following ports:
-
9995 for HTTP
-
9996 for HTTPS
-
9997 for SSH
-
9998 for SNMP
If you want to specify different ports, you can use the following environment variables:
-
-e NS_HTTP_PORT=
-
-e NS_HTTPS_PORT=
-
-e NS_SSH_PORT=
-
-e NS_SNMP_PORT=
If you are running {{page.netscaler-cpx-short}} in bridge or none network, ignore this environment variable.
The -e CPX_CORES is an optional {{page.netscaler-cpx-short}} specific environment variable. You can use it to improve the performance of the {{page.netscaler-cpx-short}} instance by defining the number of processing engines that you want the {{page.netscaler-cpx-short}} container to start.
For every additional processing engine you add, make sure that the Docker host contains the equivalent number of vCPUs and amount of memory in GB. For example, if you want to add 4 processing engines, then the Docker host must contain 4 vCPUs and 4 GB of memory.
The -e PLATFORM=CP1000 parameter specifies the {{page.netscaler-cpx-short}} license type.
If you are running Docker in a host network, you can assign dedicated network interfaces to the {{page.netscaler-cpx-short}} container using the -e CPX_NW_DEV environment variable. You need to define the network interfaces separated by a whitespace. The network interfaces that you define are held by the {{page.netscaler-cpx-short}} container until you uninstall the {{page.netscaler-cpx-short}} container. When the {{page.netscaler-cpx-short}} container is provisioned all the assigned network interfaces are added to the NetScaler networking namespace.
If you are running {{page.netscaler-cpx-short}} in a bridge network you may change the container network, such as, configure another network connection to the container or remove an existing network. Then make sure that you restart the {{page.netscaler-cpx-short}} container to use the updated network.
docker run -dt --privileged=true --net=host -e NS_NETMODE="HOST" -e EULA=yes -e CPX_NW_DEV='eth1 eth2' -e CPX_CORES=5 -e PLATFORM=CP1000 --name cpx_host cpx:12.0-53.x
The -e CPX_CONFIG is a {{page.netscaler-cpx-short}} specific environment variable that enables you to control the throughput performance of the {{page.netscaler-cpx-short}} container. When the {{page.netscaler-cpx-short}} does not receive any incoming traffic to process, it yields the CPU during this idle time, hence resulting in low throughput performance. You can use the CPX_CONFIG environment variable to control the throughput performance of the {{page.netscaler-cpx-short}} container in such scenarios. You need to provide the following values to the CPX_CONFIG environment variable in JSON format:
-
If you want the {{page.netscaler-cpx-short}} container to yield CPU in idle scenarios, define {"YIELD” : “Yes”}
-
If you want the {{page.netscaler-cpx-short}} container to avoid yielding the CPU in idle scenarios so that you can get high throughput performance, define {“YIELD” : “No”}
docker run -dt --privileged=true --net=host -e NS_NETMODE="HOST" -e EULA=yes -e CPX_CORES=5 –e CPX_CONFIG='{"YIELD":"No"}' -e PLATFORM=CP1000 --name cpx_host cpx:12.0-51.xdocker run -dt --privileged=true --net=host -e NS_NETMODE="HOST" -e EULA=yes -e CPX_CORES=5 –e CPX_CONFIG='{"YIELD":"Yes"}' -e PLATFORM=CP1000 --name cpx_host cpx:12.0-51.xx
The –v parameter is an optional parameter that specifies the mount point of the {{page.netscaler-cpx-short}} mount directory, /cpx. A mount point is a directory on the host, in which you mount the /cpx directory. The /cpx directory stores the logs, configuration files, SSL certificates, and core dump files. In the example, the mount point is /var/cpx and the {{page.netscaler-cpx-short}} mount directory is /cpx.
If you purchased a license or have an evaluation license, you can upload the license to a license server and specify the license server location with the docker run command, by using the -e LS_IP=<LS_IP_ADDRESS> -e LS_PORT=<LS_PORT> parameter. In this case, you do not need to accept the EULA.
docker run -dt --privileged=true --net=host -e NS_NETMODE="HOST" -e CPX_CORES=5 –e CPX_CONFIG='{"YIELD":"No"}' -e LS_IP=10.102.38.134 -e PLATFORM=CP1000 --name cpx_host cpx:12.0-51.xx
Where:
You can view the images running on your system and the ports mapped to the standard ports by using the command: docker ps