Product Documentation

Deploying a NetScaler CPX Instance in Docker

Dec 28, 2016

NetScaler CPX is available as a Docker image file on the Docker App Store. You need to download the NetScaler CPX image from the Docker App store and then deploy the NetScaler CPX instance using the docker run command or by using the Docker compose tool.

Prerequisites

Make sure that:

Downloading the NetScaler CPX Image from the Docker App Store

Download the NetScaler CPX Docker image from the Docker App Store. To do so, run the following command:

docker pull store/citrix/netscalercpx:11.1-53.11

After the NetScaler CPX Docker image is downloaded, you can view the details of the image by using the following command:

docker images

For example:

root@ubuntu:~# docker images
REPOSITORY    TAG       IMAGE ID       CREATED    VIRTUAL SIZE
   cpx     11.1-53.11  2e97aadf918b  43 hours ago  605.5 MB

In this example, note the following fields in the output:

  • REPOSITORY. Specifies the name space where the image is stored.
  • TAG. Denotes the version of the NetScaler CPX image that is installed.
  • IMAGE ID. Denotes the unique ID of the image in the Docker host.

Deploying the NetScaler CPX Instance Using the docker run Command

On the host, after loading the NetScaler CPX image, deploy the NetScaler CPX instance by using the docker run command, to enable external communication, you have to open the following ports: HTTP port 80, SSH port 22, and SNMP port 161. Also, make sure that you mount a directory from your Docker host.

If you have downloaded NetScaler CPX Express from https://www.citrix.com/products/netscaler-adc/cpx-express.html, make sure the you read and understand the End User License Aggreement (EULA) available at: https://www.citrix.com/products/netscaler-adc/cpx-express.html and accept the EULA while deploying the NetScaler CPX instance.

docker run -dt -p <port_number> --privileged=true -e EULA=yes --name <container_name> -v <host_directory_path>:/cpx --ulimit core=-1 cpx:11.1-52.x

Where:

  • <port_number> is the port number to establish external communication.
  • <container_name> is the name of the NetScaler CPX instance.
  • <host_directory_path> denotes the directory on the docker host that you want to mount for the NetScaler CPX instance.
docker run -dt -p 22 -p 80 -p 161/udp --privileged=true -e EULA=yes --name mycpx -v /var/cpx:/cpx --ulimit core=-1 cpx:11.1-52.x

If you have purchased a license or have an evaluation license, you can upload the license to a license server and specify the license server location in the docker run command. In this case, you do not have to accept the EULA.

docker run -dt -p 80 -p 22 -e LS_IP=<LS_IP_ADDRESS> -e LS_PORT=<LS_PORT> -e PLATFORM=CP1000 --name=<NAME> --hostname=<HOSTNAME> --privileged=true -v <host_directory_path>:/cpx --ulimit core=-1 <repository>:<tag>

Where:

  • LS_IPADDRESS is the IP address of the license server.
  • LS_PORT is the port of the licesnse server.
  • NAME is the name of the container.
  • HOSTNAME is the hostname of the container.
docker run -dt -p 80 -p 22 -e LS_IP=1.2.3.4 -e LS_PORT=27000 -e PLATFORM=CP1000 --name=test --hostname=testhost --privileged=true -v /var/cpx:/cpx--ulimit core=-1 cpx:11.1.52.x

You can view the images running on your system and the ports mapped to the standard ports by using the command: docker ps

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6fe01203e7b9 cpx:11.1-53.x "/bin/sh -c 'bash -C " 7 seconds ago Up 5 seconds 443/tcp, 0.0.0.0:32769->22/tcp, 0.0.0.0:32768->80/tcp, 0.0.0.0:32768->161/udp mycpx

Deploying NetScaler CPX Instances by Using Docker Compose

You can use the Compose tool of Docker to provision a single NetScaler CPX instance or multiple NetScaler CPX instances. To provision NetScaler CPX instances by using Compose, you must first write a compose file specifying the NetScaler CPX image, ports that you want to open for the NetScaler CPX instance, and the privileges for your NetScaler CPX instance.

To provision multiple NetScaler CPX instances:

  1.  Write a compose file. The compose file generally follows a format similar to:

     <service-name>:
         container_name:
         image: <repository>:<tag>
         ports:
             - 22
             - 80
         tty: true
         privileged: true
         ulimits:
         core: -1
         environment:
             - EULA=yes
         volumes:
             - <host_directory_path>:/cpx
    

    Where:

    • <service-name> is the name of the service you want to provision.
    • image:<repository>:<tag> denotes the repository and the versions of the NetScaler CPX image.
    • privileged: true provides all root privileges to the NetScaler CPX instance.
    • <host_directory_path> denotes the directory on the docker host that you want to mount for the NetScaler CPX instance.

    Sample Compose file:

     cpx_DUT-BRIDGE_0:
     container_name: cpx_DUT-BRIDGE_0_my
     image: cpx:11.1-52.xx
     ports:
         - 22
         - 80
     tty: true
     privileged: true
     ulimits:
         core: -1
     environment:
         - EULA=yes
     volumes:
         - /var/cpx:/cpx
    

    Note

    If you want to provision a single NetScaler CPX instance, you must add the following line to the compose file:

    container_name:<name_of_container>

  2.  Run the following command to provision multiple NetScaler CPX instances:  

     docker-compose -f <compose_file_name> scale <service-name>=<number of instances> up –d
    
     docker-compose -f docker-compose.yml scale cpxlb=3 up –d
    

    Note

    If you want to provision a single NetScaler CPX instance, run the following command:

    docker-compose -f <compose_file_name> up –d