How to run code analyses using Docker
Overview
The Online Docker Analyzer runs the CAST Imaging Analyzer in a Docker container on your own machine. CAST provides it as an image on Docker Hub that is regularly updated. This page is for users who want to analyze source code from the command line with Docker.
How does it work?
You run the analyzer from the command line on your machine. Docker Engine runs on Microsoft Windows, macOS and Linux.
- Your source code stays on your machine. It is analyzed locally and is not uploaded to CAST Imaging Express. If AI Transaction Summary is enabled, the source code of each object is sent to your organization’s own AI provider to generate summaries; the source code is never stored.
- Only the extensions you need are downloaded. The analyzer detects the technologies in your source code and downloads only the extensions required to analyze them.
- Results are uploaded automatically. When the analysis is complete, the results are sent to CAST Imaging Express.
Prerequisites
- Docker installed and running
- Internet access from the machine running the analyzer
- An API key - see Generate and use an API key
Run the analyzer
The command is tailored to your organization, so always copy it from CAST Imaging Express rather than typing it: click Start analysis, select the Docker tab and copy the command from the Docker Setup box. Then replace the placeholders in square brackets with your own values:

This analyzer requires internet access and an API key. To analyze source code on a machine without internet access, or without an API key, use the Offline Docker Analyzer instead.
The copied command has the following form:
docker run --rm --pull always -v [SOURCE_CODE_PATH]:/home/carl/extras/source -v [CACHE_PATH]:/home/carl/extras/extensions -v [RESULT_PATH]:/home/carl/extras/results castimaging/imaging-docker-analyzer:latest -ak [API_KEY] -n [APP_NAME] -t [TENANT]
Where:
[SOURCE_CODE_PATH]- is the path to the local folder containing your source code[CACHE_PATH]- is the path to a local folder where extensions will be downloaded and cached[RESULT_PATH]- is the path to a local folder where a copy of the results and the log file are written, in a date stamped folder (UTC) per analysis:[RESULT_PATH]/[APP_NAME]/<yyyymmdd-hhmmss>/[API_KEY]- is your CAST Imaging Express API key - see Generate and use an API key[APP_NAME]- is your Application Name[TENANT]- identifies your organization’s tenant in CAST Imaging Express, so that the results are uploaded to your organization. The command copied from Start analysis already contains the correct value: do not change it
Note that:
--pull always- usingalwayswill ensure that the image is always updated to the latest version before the analysis is run (recommended)--rmwill automatically delete the container when the analysis is complete, remove this parameter if you want to access the container after the analysis is complete.- Create the
[CACHE_PATH]folder before you run the command. - Docker must have permission to read and write the folders you mount.
For example:
docker run --rm --pull always -v /home/CAST/app1:/home/carl/extras/source -v /home/CAST/extensions:/home/carl/extras/extensions -v /home/CAST/results:/home/carl/extras/results castimaging/imaging-docker-analyzer:latest -ak NG8pzC3I.6R8EI5vBR3qaNZO -n APP1 -t mycompany