# Cis Docker 4.9

> Ensure that COPY is used instead of ADD in Dockerfiles

- Skill: `cyberstrikeus/cis-docker-4-9` (Agent Skill)
- Install (CLI): `npx skillmds@latest add cyberstrikeus/cis-docker-4-9`
- Raw SKILL.md: https://api.skillmd.com/api/skills/cyberstrikeus/cis-docker-4-9/raw
- Safety review: PASS (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: DevOps & Infra
- Author: cyberstrikeus (https://skillmd.com/u/cyberstrikeus)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/cyberstrikeus/cis-docker-4-9

---


# 4.9 Ensure that COPY is used instead of ADD in Dockerfiles (Manual)

## Profile Applicability

- Level 1 - Docker - Linux

## Description

You should use the `COPY` instruction instead of the `ADD` instruction in the Dockerfile.

## Rationale

The `COPY` instruction simply copies files from the local host machine to the container file system. The `ADD` instruction could potentially retrieve files from remote URLs and perform operations such as unpacking them. The `ADD` instruction therefore introduces security risks. For example, malicious files may be directly accessed from URLs without scanning, or there may be vulnerabilities associated with decompressing them.

## Impact

Care needs to be taken in implementing this control if the application requires functionality that is part of the `ADD` instruction, for example, if you need to retrieve files from remote URLs.

## Audit Procedure

Run the command below to get the list of images:

```bash
docker images
```

Run the command below against each image in the list above and look for any `ADD` instructions:

```bash
docker history <IMAGE_ID>
```

Alternatively, if you have access to the Dockerfile for the image, you should verify that there are no `ADD` instructions.

## Remediation

You should use `COPY` rather than `ADD` instructions in Dockerfiles.

## Default Value

Not Applicable

## References

1. https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#add-or-copy

## CIS Controls

### v8

**16.7 Use Standard Hardening Configuration Templates for Application Infrastructure**

Use standard, industry-recommended hardening configuration templates for application infrastructure components. This includes underlying servers, databases, and web servers, and applies to cloud containers, Platform as a Service (PaaS) components, and SaaS components. Do not allow in-house developed software to weaken configuration hardening.

### v7

**5.2 Maintain Secure Images**

Maintain secure images or templates for all systems in the enterprise based on the organization's approved configuration standards. Any new system deployment or existing system that becomes compromised should be imaged using one of those images or templates.

