Fehler beim Ausführen von Migrationen in einem Docker-ContainerPython

Python-Programme
Anonymous
 Fehler beim Ausführen von Migrationen in einem Docker-Container

Post by Anonymous »

Ich erhalte diese Fehlermeldung, wenn ich versuche, Migrationen in meinem Container auszuführen. Ich kann anscheinend nicht herausfinden, warum.

Code: Select all

Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"alembic\": executable file not found in $PATH": unknown
Docker-Datei:

Code: Select all

FROM python:3.8.2
WORKDIR /workspace/
COPY . .
RUN pip install pipenv
RUN pipenv install --deploy --ignore-pipfile
#EXPOSE 8000
#CMD ["pipenv", "run", "python", "/workspace/bin/web.py"]

Docker-Compose:

Code: Select all

version: '3'
services:
db:
image: postgres:12
ports:
- "5432:5432"
env_file:
- .env.database.local
pgadmin:
container_name: pgadmin
image: dpage/pgadmin4
environment:
- [email protected]
- PGADMIN_DEFAULT_PASSWORD=admin
ports:
- "5050:80"
depends_on:
- db
redis:
image: "redis:alpine"
web:
build: .
environment:
- PYTHONPATH=/workspace
env_file:
- .env.local
ports:
- "8000:8000"
volumes:
- .:/workspace
depends_on:
- db
- redis
command: "alembic upgrade head && pipenv run python /workspace/bin/web.py"
Der Befehl, den ich ausführe, wenn dieses Problem auftritt:

Code: Select all

docker-compose run web alembic revision - autogenerate -m "First migration"
Image


Ich habe in meiner Docker-Datei definiert, dass mein gesamtes Programm im Arbeitsbereichsverzeichnis ausgeführt wird. Es sollte also darauf hinweisen.

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post