https://github.com/pmd/docker
Repo containing the dockerfiles and scripts to produce the official PMD containers.
https://github.com/pmd/docker
containers docker dockerfile dockerhub
Last synced: 6 months ago
JSON representation
Repo containing the dockerfiles and scripts to produce the official PMD containers.
- Host: GitHub
- URL: https://github.com/pmd/docker
- Owner: pmd
- License: bsd-3-clause
- Created: 2025-04-04T08:16:05.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-04-04T14:25:48.000Z (9 months ago)
- Last Synced: 2025-04-09T20:58:58.415Z (9 months ago)
- Topics: containers, docker, dockerfile, dockerhub
- Language: Dockerfile
- Homepage: https://hub.docker.com/r/pmdcode/pmd
- Size: 14.6 KB
- Stars: 0
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PMD Docker
[](https://hub.docker.com/r/pmdcode/pmd)
[](https://hub.docker.com/r/pmdcode/pmd)
Provides [PMD](https://pmd.github.io) packaged in a Docker image ready to use. It uses the alpine linux
flavor of [Eclipse Temurin](https://hub.docker.com/_/eclipse-temurin) as the basis.
* **Maintained by:** [PMD](https://github.com/pmd/docker)
* **Dockerfile:** https://github.com/pmd/docker/blob/main/Dockerfile
* **Available at these registries:**
* https://hub.docker.com/r/pmdcode/pmd (`docker pull pmdcode/pmd`)
* https://github.com/pmd/docker/pkgs/container/pmd (`docker pull ghcr.io/pmd/pmd`)
## Quickstart
```
docker run --rm --tty -v $PWD:/src pmdcode/pmd:latest check -d . -R rulesets/java/quickstart.xml
```
## How to use this image
### Verify it works
This just displays the PMD version.
```
docker run --rm --tty pmdcode/pmd:latest --version
```
### Only using default rulesets
In order to give access to the source code being analyzed, bind-mount the project source folder
using `-v /path/to/project:/project`:
```
docker run --rm --tty -v /path/to/project:/project pmdcode/pmd:latest \
check -d /project/src/main/java -R rulesets/java/quickstart.xml
```
### Writing XML report into a file
Since the bind-mount has write-access by default, you can use it as the output destination for a report file in XML format:
```
docker run --rm --tty -v /path/to/project:/project pmdcode/pmd:latest \
check -d /project/src/main/java -R rulesets/java/quickstart.xml -r /project/target/pmd-report.xml -f xml
```
### Use custom rulesets / rules
If you use a custom ruleset or rule, you need to add this onto PMD's runtime classpath. By default, the container
will pick-up any jar file that is in the folder `/custom-pmd-libs`. That means, you just need to add another
bind-mount for this:
```
docker run --rm --tty -v /path/to/project:/project -v /path/to/custom-rule-jars:/custom-pmd-libs \
pmdcode/pmd:latest check -d /project/src/main/java -R rulesets/java/quickstart.xml
```
## How to build the docker image
```
PMD_VERSION=7.12.0; \
export PMD_VERSION; \
docker build --load \
--no-cache \
--progress=plain \
--build-arg PMD_VERSION=$PMD_VERSION \
--tag pmdcode/pmd:$PMD_VERSION \
--tag pmdcode/pmd:latest \
- < Dockerfile
```