Q: Docker does not find the application directory

Asked

Viewed 8 times

-2

Before describing the problem I would like to inform you that I am new in the field of programming and am learning how to use Docker now, so I ask for everyone’s understanding.

I’m spinning a docker-compose up, the Postgres container is working properly, however, the api container returns code 1 and an error message indicating that it did not find the directory, I have tried using other directories, insert permissions, but nothing solved the problem

Message that appears in the application container:

standard_init_linux.go:211: exec user process caused "no such file or directory"

Dockerfile:

FROM node:lts-alpine

WORKDIR /home/app/api

COPY package.json yarn* ./

RUN yarn

COPY . . 

EXPOSE 3000

ENTRYPOINT ["./init.sh"]

init.sh:

#!bin/sh
yarn sequelize db:migrate
yarn dev

Docker-Compose.yml:

version: '3'

services:

  api:
    container_name: api
    build: .
    command: yarn dev
    volumes:
      - .:/home/app/api
    depends_on:
      - postgres
    networks:
      - app-connect
    ports:
      - '3000:3000'

  postgres:
    container_name: postgres
    image: postgres:13
    restart: unless-stopped
    volumes:
      - postgres-data:/data
    ports: 
      - '5432:5432'
    environment: 
      POSTGRES_DB: ${DB_NAME}
      POSTGRES_USER: ${DB_USER}
      POSTGRES_PASSWORD: ${DB_PASS} 
    networks:
      - app-connect

volumes:
  postgres-data:

networks:
  app-connect:
      driver: bridge

Console return:

inserir a descrição da imagem aqui

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.