Container security scanning
Container scanning checks images for known vulnerabilities and Dockerfiles for risky settings.
Included in Premium and Ultimate.
What it looks for
Image packages
Known vulnerabilities in packages included in an image.
Base images
Vulnerabilities that come from the image you build on.
Dockerfiles
Risky settings, such as running as the root user.
Examples
These examples show common problems and safer ways to write the code. They are not AquilaX results, and scanner coverage can vary.
Three problems in five lines
CIS Docker 4.1DockerfileHighFROM node:14 WORKDIR /app COPY . . RUN npm install CMD ["node", "server.js"]
node:14 reached end of life in April 2023, and its Debian base carries hundreds of known CVEs. COPY . . with no .dockerignore bakes .env, .git and local keys into the image.
And with no USER line the app runs as root, so any code-execution bug gets root inside the container.
FROM node:24-alpine WORKDIR /app COPY package*.json ./ RUN npm ci --omit=dev COPY src ./src USER node CMD ["node", "src/server.js"] # .dockerignore: .env .git *.pem
A deploy key "deleted" in a later layer
CWE-522DockerfileCriticalCOPY id_rsa /root/.ssh/id_rsa RUN git clone [email protected]:acme/private-lib.git /lib RUN rm /root/.ssh/id_rsa
Every instruction creates a layer, and rm only hides the file from the final view. docker save and a tar extract get the key back from the COPY layer.
Anyone who can pull the image now has your deploy key.
# syntax=docker/dockerfile:1 RUN --mount=type=ssh git clone [email protected]:acme/private-lib.git /lib # build with: docker build --ssh default .
A privileged pod with the host disk mounted
CIS K8s 5.2KubernetesCriticalcontainers:
- name: agent
image: acme/agent:latest
securityContext:
privileged: true
volumeMounts: [{ name: host, mountPath: /host }]
volumes:
- name: host
hostPath: { path: / }
A privileged container with the node's root filesystem mounted is the node. chroot /host gives root, plus the kubelet's credentials to move through the rest of the cluster.
:latest also means you can't tell which image is actually running.
image: acme/agent:1.8.2
securityContext:
privileged: false
allowPrivilegeEscalation: false
runAsNonRoot: true
readOnlyRootFilesystem: true
capabilities: { drop: ["ALL"] }
What to know
- Very large results are kept. If needed, the lowest-severity vulnerabilities are shown as a summary.
- Build a new image after you update a base image or package.
- Use IaC scanning for Kubernetes files. Use the CSPM add-on to check running clusters.
Questions and answers
Does container scanning check a running cluster?
No. The CSPM add-on checks running Kubernetes clusters.
How do I fix a vulnerability in a base image?
Choose an updated base image if one is available. Build and test your image, then scan it again.
What is the difference between container scanning and SCA?
SCA checks the packages your project depends on. Container scanning checks the packages in an image, including those from its base image. Some packages can appear in both.
Why does my image have vulnerabilities I did not add?
They may come from the base image. Choosing an updated or smaller base image can reduce the number of packages that need fixing.
Why are Dockerfile findings labelled IaC?
A Dockerfile contains build settings, so the IaC scanner may report problems such as running as the root user. Check both the container and IaC findings.
What happens if an image has a very large number of findings?
AquilaX keeps the results. If there are too many to show in full, it summarises the lowest-severity vulnerabilities.
How often should I scan an image?
Scan it when you build it, and scan again regularly. New vulnerabilities can be published even when your image has not changed. You can also use an automation to start scans on a schedule.
Which plan includes this scanner?
Included in Premium and Ultimate. Compare plans.
Try it on one of your repositories
Create a free account and run a scan. If you need Ultimate, self-hosting or a larger rollout, talk to our team.
No credit card needed. Read the documentation