skip to Main Content

Im try up a Stack, but when i deploy a container using docker compose up, the postgresQL up, but my app in Python send this exception.

Error in pythonapi

But the entrypoint.sh still in container.

enter image description here

This is my docker-compose.yml

version: '3'

services:
  postgresql:
    image: postgres:alpine3.18
    container_name: postgresql
    ports:
      - "5432:5432"
    environment:
      - POSTGRES_USER=paulitos
      - POSTGRES_PASSWORD=123456
      - POSTGRES_DB=eventon
  pythonapi:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: pythonapi

This is my Dockerfile

FROM python:alpine3.18

VOLUME /home/app/data

WORKDIR /home

COPY app /home/app

WORKDIR /home/app

RUN chmod +x entrypoint.sh

EXPOSE 8000

CMD ["/home/app/entrypoint.sh"]
#!/bin/bash

echo -e "33[0;32m Instalando dependencias 33[0;32m"

pip install --upgrade pip

pip install -r requirements.txt

echo -e "33[0;32m Iniciando aplicacao 33[0;32m"

echo -e "33[1;33m Iniciando Migração "  $IP "33[1;33m"

python manage.py makemigrations

python manage.py migrate

echo -e "33[1;33m Iniciando Serviço "  $IP "33[1;33m"

python manage.py runserver

2

Answers


  1. #!/bin/bash
    

    Your script wants to start bash. There is no bash installed in docker alpine image. Install bash or change the script to sh.

    Login or Signup to reply.
  2. The WORKDIR is already /home/app. Try changing the CMD to just entrypoint.sh

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search