standard_init_linux.go:219: exec user process caused: no such file or directory - docker problem

Viewed 6213

I have a problem with the docker, when running the command docker-compose up -d --build 3 containers app, database, api are created within the application innovation, however when accessing the docker terminal in the api container I get this error`` this is my docker-compose.yaml:

version: "3"

services:
  api:
    build: ./api
    entrypoint: ./.docker/entrypoint.sh
    container_name: quimiweb-innovation-api
    env_file: .env
    environment:
      DATABASE_CLIENT: ${DATABASE_CLIENT}
      DATABASE_NAME: ${DATABASE_NAME}
      DATABASE_HOST: ${DATABASE_HOST}
      DATABASE_PORT: ${DATABASE_PORT}
      DATABASE_USERNAME: ${DATABASE_USERNAME}
      DATABASE_PASSWORD: ${DATABASE_PASSWORD}
      FRONTEND_URL: ${FRONTEND_URL}
    ports:
      - "1337:1337"
    volumes:
      - ./api/:/home/node/api
    networks:
      - app-network

  database:
    image: mongo
    container_name: quimiweb-innovation-database
    env_file: .env
    environment:
      MONGO_INITDB_ROOT_USERNAME: ${MONGO_INITDB_ROOT_USERNAME}
      MONGO_INITDB_ROOT_PASSWORD: ${MONGO_INITDB_ROOT_PASSWORD}
    networks:
      - app-network
    volumes:
      - .database/:/data/db
    ports:
      - "27017:27017"

  app:
    build: ./app/
    entrypoint: ./.docker/entrypoint.sh
    container_name: quimiweb-innovation-app
    env_file: .env
    environment:
      SKIP_PREFLIGHT_CHECK: ${SKIP_PREFLIGHT_CHECK}
    ports: 
      - 3001:3001
    volumes:
      - ./app/:/home/node/app       

networks:
  app-network:
    driver: bridge

volumes:
  app-volume:

My entrypoint.sh from api:

#!/bin/bash

yarn
yarn develop
4 Answers

In my case, I resolved it by changing the line endings from CRLF to LF for the entrypoint.sh file

Edit

In Notepad++ on the bottom panel on to the Right, right-click on the area Windows (CR LF) and select UNIX (LF) this should replace all CRLFs with LFs.

This error may also occur when starting an image built on a 64-bit x86 agent but running on a 64-bit Arm container host.

For me the line endings were already LF, I had removed all the images and rebuilt them but before building, I found I was missing the shebang -

#!/bin/bash

I just added that and rebuilt the container and found it working.

Same problem, resolved it as Thyi by changing the line endings. Also had to rebuild the image before the change took effect.

Related