# Run yc-360 Script in Same Container Beta
You can run both your target Java application and the yc-360 script inside the same Docker container. This allows the script to directly capture troubleshooting artifacts from the application process without needing inter-container communication.
Below are the steps to include and run the yc-360 script inside your Java application's Docker image:
# 1. Inject the yc-360 Script into the Java Application Container
There are two supported methods to include the yc-360 script in your existing container.
Option 1: Download the yc-360 Script into your Application Container
If you're building a custom Docker image for your Java application, you can add the following instructions to your Dockerfile to install the yc-360 script:
# 1. Install process and network tools
RUN apk update && \
apk add --no-cache unzip procps net-tools
# 2. Create a folder for yc-360 script
RUN mkdir -p /opt/workspace/yc-360-script
# 3. Install curl
RUN apk update && \
apk add --no-cache curl
# 4. Download yc-360 script
RUN cd /opt/workspace/yc-360-script \
&& curl -fsSL https://tier1app.com/dist/ycrash/yc-360-latest.zip -o yc-360-latest.zip \
&& unzip -o yc-360-latest.zip \
&& rm yc-360-latest.zip \
&& chmod u+rx /opt/workspace/yc-360-script/linux/yc
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Then build and run your Docker container as usual:
docker build -t <imagename> .
docker run <imagename>
2
Option 2: Manually Copy the yc-360 Script into a Running Container
If your container is already running, you can manually copy the script into it using the following steps:
# 1. Download the script on your local machine:
curl -fsSL https://tier1app.com/dist/ycrash/yc-360-latest.zip -o yc-360-latest.zip
# 2. Create a directory inside the container:
docker exec {container_id} mkdir -p /opt/workspace/yc-360-script
# 3. Copy the script into the container:
docker cp yc-360-latest.zip {container_id}:/opt/workspace/yc-360-script
# 4. Extract the script inside the container:
docker exec {container_id} unzip /opt/workspace/yc-360-script/yc-360-latest.zip -d /opt/workspace/yc-360-script
# 5. Set execute permissions:
docker exec {container_id} chmod +rx /opt/workspace/yc-360-script/linux/yc
INFO
To simplify this process, use our helper script to automate the steps above. You can download it from here (opens new window).
Run the helper script using:
sh copy-yc-360-script.sh {container_id}
# 2. Create YAML Configuration File
The yc-360 script supports multiple execution modes tailored for various monitoring needs. Select your preferred mode below to see how to configure the script.
Not sure what these modes mean? Learn more about Execution Modes
How to Locate Java in a Docker Container?
To determine the Java installation path inside a Docker container, you can run the following command:
docker exec {container_id} which java
# 3. Copy the YAML Configuration File to the Container
After updating the yc-config.yaml file locally, copy it to your running container:
docker cp yc-config.yaml {container_id}:/opt/workspace/yc-360-script/linux/
# 4. Execute yc-360 Script
Select your desired execution mode, and run the script with the following command:
IMPORTANT NOTE
The yc-360 script must be executed with the same user privileges as the Java application. For example, if the application runs under the
tomcat-useruser, yc-360 script must also be executed bytomcat-useruser.To detect memory-related issues, GC logging must be enabled for your application. You can enable GC logging by using the JVM arguments listed here.
The yc-360 script doesn't capture heap dump by default. Pass
-hdargument to capture heap dump. For more information, please visit How to Capture Heap Dump?If you get an error while running yc-360 script in Alpine docker container, please install a
libec6-compatpackage in your Alpine docker container. For example,
RUN apk add --no-cache libc6-compat