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.
But the entrypoint.sh still in container.
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
Your script wants to start bash. There is no bash installed in docker alpine image. Install bash or change the script to sh.
The
WORKDIR
is already/home/app
. Try changing theCMD
to justentrypoint.sh