This topic explains how to build a Docker container image for running C/C++test Standard.
C/C++test ships with support for building a Docker container image in the <INSTALL_DIR>/integration/docker
directory. The directory contains an example Dockerfile you can easily customize.
To build a Docker container image that includes C/C++test:
INSTALL_DIR>/integration/docker
directory.INSTALL_DIR>/integration/docker
directory.Run the following command in the <INSTALL_DIR>/integration/docker
directory to build the image:
docker build -t cpptestcli:latest |
The image will include runnable C/C++test and other tools you specified in the Dockerfile.
You can license and configure C/C++test before the container image is built. This allows you to provide a default C/C+test configuration to all users of the image.
Add the license settings and other configuration settings to the cpptestcli.properties file.
You must configure a network license to run C/C++test in a Docker container. The local license is not supported. See Setting the License for details. |
INSTALL_DIR>/integration/docker
directory.COPY cpptestcli.properties /opt/parasoft/cpptest
. This will add the cpptestcli.properties file to the /opt/parasoft/cpptest
directory in the container image.See Configuration for details about configuring C/C++test and a complete list of available settings.
Once you built the Docker container image that includes C/C++test, you can utilize all of the C/C++test's capabilities available from the command line interface. If C/C++test was not licensed and configured when the image was built, you need to create a cpptestcli.properties file in the current directory ($PWD) and configure the license and other options before you run C/C++test (see Configuration).
Use the following command to run C/C++test from the image:
docker run --rm -v $PWD:$PWD -w $PWD cpptestcli [C/C++test's command line options] |
The following command prints the available test configurations:
docker run --rm -v $PWD:$PWD -w $PWD cpptestcli -list-configs |
The following command executes analysis on a project located on the host in the current working directory ($PWD):
docker run --rm -v $PWD:$PWD -w $PWD cpptestcli -compiler gcc_9-64 -module . -trace make clean all |
The following command runs static analysis on an example ATM project located inside the container (/opt/parasoft/cpptest/examples/ATM
) using a cpptestcli.properties settings file that is located on the host in the current working directory ($PWD):
docker run --rm -v $PWD:$PWD -w /opt/parasoft/cpptest/examples/ATM cpptestcli -settings $PWD/cpptestcli.properties -compiler gcc_9-64 -module . -trace make clean all |
See Command Line Options for a complete list of C/C++test's command line options.