Configuring {{page.netscaler-cpx-short}} Using a Configuration File

Last published : Sep 02, 2026
Instead of using command line interface (cli_script.sh), NITRO API, or NetScaler Management and Analytics (MAS) configuration jobs to configure the {{page.netscaler-cpx-short}}, you can configure the {{page.netscaler-cpx-short}} using a static configuration file while deploying the {{page.netscaler-cpx-short}} instance.
You can provide a static configuration file as an input file while deploying the {{page.netscaler-cpx-short}} container. During {{page.netscaler-cpx-short}} container startup, the container is configured based on the configuration specified in the static configuration file. This configuration includes NetScaler-specific configuration and bash shell commands that you can dynamically run on the {{page.netscaler-cpx-short}} container.

Structure of the static configuration file

As mentioned above, when {{page.netscaler-cpx-short}} is deployed, it is configured based on the configurations specified in the static configuration file.
The static configuration file is a .conf file that includes two tags, #NetScaler Commands and #Shell Commands. Under the #NetScaler Commands tag, you must add all the NetScaler commands to configure the NetScaler-specific configuration on {{page.netscaler-cpx-short}}. Under the #Shell Commands tag, you must add the shell commands that you want to run on {{page.netscaler-cpx-short}}.
During the {{page.netscaler-cpx-short}} container deployment, the NetScaler commands and shell commands are run on the container in the order specified in the configuration file.
Important:
  • The tags can be repeated multiple times in the configuration file.
  • The tags are not case-sensitive.
  • The configuration file must be present in the /etc directory as cpx.conf file in the container’s file system.
  • The configuration file can also include comments. You must add a “#” character before your comments.
  • If there are failure scenarios while deploying the {{page.netscaler-cpx-short}} container with the configuration file, the failures are logged in the ns.log file in the container.
  • When you reboot the {{page.netscaler-cpx-short}} container the configuration file is reapplied on the container.
#NetScaler Commands

add lb vserver v1 http 1.1.1.1 80

add service s1 2.2.2.2 http 80

bind lb vserver v1 s1

#Shell Commands

touch /etc/a.txt

echo "this is a" > /etc/a.txt

#NetScaler Commands

add lb vserver v2 http

#Shell Commands

echo "this is a 1" >> /etc/a.txt

#NetScaler Commands

add lb vserver v3 http

#This is a test configuration file
To install a {{page.netscaler-cpx-short}} container and to dynamically configure the {{page.netscaler-cpx-short}} container based on a configuration file, mount the static configuration file using the - v option in the docker run command:
docker run -dt --privileged=true -e EULA=yes --ulimit core=-1 -v /tmp/cpx.conf:/etc/cpx.conf --name mycpx store/citrix/netscalercpx:12.1-48.13