Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Keploy docker setup in macOS

Tags:

java

docker

I am trying to use Keploy on MacOS, I did followed setup instruction from https://keploy.io/docs/server/installation/#other-installation-methods

But when I am trying to run following command keploy record -c "docker compose up" --container-name springSampleApp --build-delay 10 I am getting error:

version: 2.3.0-beta48

🐰 Keploy: 2025-01-07T17:45:53+05:30    INFO    Starting keploy in docker with image    {"image:": "ghcr.io/keploy/keploy:v2.3.0-beta48"}
🐰 Keploy: 2025-01-07T17:45:53+05:30    INFO    Starting keploy in docker with default context, as that is the current context.
docker: invalid reference format.
See 'docker run --help'.
🐰 Keploy: 2025-01-07T17:45:54+05:30    ERROR   failed to start keploy in docker        {"error": "exit status 125"}
🐰 Keploy: 2025-01-07T17:45:54+05:30    ERROR   failed to run the command in docker     {"error": "exit status 125"}
🐰 Keploy: 2025-01-07T17:45:54+05:30    ERROR   failed to validate flags        {"error": "exit status 125"}

This is how my docker-compose file looks:

version: '3'
services:
  sample-app:
    image: custom-image:a2a428c7d399c6ad867b544b59141188121863d6
    build:
      context: .
    container_name: springSampleApp
    ports:
      - "8080:8080"
    networks:
      - keploy-network

networks:
  keploy-network:
    external: true
    

Contents of Dockerfile:

FROM artifactory.aexp.com/dockerproxy/openjdk:21-jdk

COPY . /app

WORKDIR /app/

USER root

RUN chmod -R 755 /app/

EXPOSE 8080

CMD ["java","-jar","-Djavax.net.debug=ssl:handshake","-DAPP_NAME=log-readr-writer","build/libs/app-0.0.1-SNAPSHOT.jar","--server.address=0.0.0.0","--server.port=8080"]

I am not sure what I am missing here

like image 900
Tripathi Mridul Avatar asked Oct 23 '25 16:10

Tripathi Mridul


1 Answers

Seems like you are trying with PetClinic application, and the error seems with the ./setup_ca.sh, the url seems to be incorrect current in the dockerfile.

Correct Package URL can be found here - https://keploy.io/docs/running-keploy/docker-tls/

Can you update your Dockerfile with below: -

# Use an official OpenJDK runtime as a parent image
FROM openjdk:22-bookworm

# Set the working directory to /app
WORKDIR /app

# Install Maven
RUN apt-get update && apt-get install -y maven

# Copy the current directory contents into the container at /app
COPY . /app/

# Build the binary
RUN mvn clean install -Dmaven.test.skip=true

# Expose the port the app runs on
EXPOSE 9966

# Download the ca.crt file
RUN curl -o ca.crt https://raw.githubusercontent.com/keploy/keploy/main/pkg/core/proxy/asset/ca.crt

RUN curl -o setup_ca.sh https://raw.githubusercontent.com/keploy/keploy/main/pkg/core/proxy/tls/asset/setup_ca.sh

# Give execute permission to the setup_ca.sh script
RUN chmod +x setup_ca.sh

# Run the application when the container launches
# CMD ["java", "-jar", ""]
CMD ["/bin/bash", "-c", "source ./setup_ca.sh && java -jar target/spring-petclinic-rest-3.0.2.jar"]

I tried and seems to work for me.

like image 132
Animesh Avatar answered Oct 26 '25 06:10

Animesh