user3571643
user3571643

Reputation: 11

Docker exec command is failing with EXIT CODE 137

I am running a CICD pipeline that runs a test script inside a docker container with docker exec and its failing with a return code of 137 every 3rd or 4th time. Here is the code that's running:

docker-compose -p 1234 -f docker-compose.yml exec -T webapp run_tests.sh
STATUS=$?
...
docker-compose -p 1234 -f docker-compose.yml logs --no-color webapp
...
exit $STATUS

Thing is whenever it fails with EXIT CODE 137, container gets killed immediately and there are no logs available for debugging. I think 137 is caused by some external process but I am not able to trace it. Any insights into this will be very helpful.

Upvotes: 1

Views: 9845

Answers (2)

Erlang Parasu
Erlang Parasu

Reputation: 363

I experience related error too, in my case i got error when executing docker-compose exec on my Jenkins build. Fixed by add deploy config to docker-compose.yaml to increase memory limit

# docker-compose.yaml
version: '3.8'
services:
  app:
    image: my-app:1.0.0
    build:
      context: .
      dockerfile: ./Dockerfile 
    # ports: 
    # networks: 
    # volumes: 
    # depends_on: 
    deploy:
      resources:
        limits:
          memory: 500M
        reservations:
          memory: 128M

Try changing deploy.resources.limits.memory and deploy.resources.reservations.memory

Ref: https://docs.docker.com/compose/compose-file/deploy/#resources

Upvotes: 1

vanelo
vanelo

Reputation: 21

Thanks for your question, I experience a related error and it was related to a memory limit, try to increase your swap memory. Here a link with someone with similar problem

Upvotes: 2

Related Questions