---
title: "Java Docker Configuration"
slug: "java-docker-configuration-prefix"
updated: 2022-01-03T20:08:51Z
published: 2022-01-03T20:08:51Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stackify.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Java Docker Configuration

Follow the instructions here on how to add our profiler to your Dockerfile.

## Environment Variables

Set the StackifyPrefix environment variable to 1 to set the profiler to Prefix mode. This will put Prefix compatible traces in `/usr/local/prefix/log` (Unices) or `%ALLUSERSPROFILE%\Stackify\Agent\log` (Windows).

## Binding the Host Trace directory to the Guest Trace directory

To get Prefix to read the traces from your app in docker, you need to use bind-mounts as mentioned in [this article](https://docs.docker.com/storage/bind-mounts/).

## Example

If the host OS is Windows and you have a Linux OS in the container, you need to bind `%ALLUSERSPROFILE%\Stackify\Agent\log` to `/usr/local/prefix/log` for Prefix to see the logs.

          Fixed Logging Directories for Java traces

          

Linux: `/usr/local/prefix/log`

Windows: `%ALLUSERSPROFILE%\Stackify\Agent\log` `%ALLUSERSPROFILE` is an environment variable. This is usually located at `C:\ProgramData` but may be on another drive. In Powershell, this would be `$Env:ALLUSERSPROFILE`.

This will work on Docker Desktop because it detects [Windows style paths](https://docs.docker.com/desktop/windows/troubleshoot/#path-conversion-on-windows).

## To bind these directories

We use the ***--mount*** argument for the docker run command as follows: `docker run -it --rm -p 8000:80 \ --mount type=bind,source="$Env:ALLUSERSPROFILE",target=/usr/local/prefix/log \ --name java_sample java-apm`
