Я пытаюсь раскрутить докер img postgres db рядом с моим приложением.
Мне интересно, если это какая-то совместимость с Linux, так как я запускаю Docker на Windows 10?
Когда я запускаю команду: docker-compose -f docker-compose-dev.yml up --build
Я добираюсь до самого дна и терплю неудачу:
Starting testdriven-app_users-db_1 ... done
Recreating testdriven-app_users_1 ... done
Attaching to testdriven-app_users-db_1, testdriven-app_users_1 users-db_1 | 2018-11-06 01:39:05.178 UTC [1] LOG: listening on IPv4 address"0.0.0.0", port 5432
users-db_1 | 2018-11-06 01:39:05.178 UTC [1] LOG: listening on IPv6 address "::", port 5432
users-db_1 | 2018-11-06 01:39:05.198 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
users-db_1 | 2018-11-06 01:39:05.212 UTC [20] LOG: database system was shut down at 2018-11-06 01:37:48 UTC
users-db_1 | 2018-11-06 01:39:05.216 UTC [1] LOG: database system is ready to accept connections
users_1 | standard_init_linux.go:190: exec user process caused "no such file or directory"
testdriven-app_users_1 exited with code 1
вот мой файл yml:
version: "3.6"
services:
users:
build:
context: ./services/users
dockerfile: Dockerfile-dev
volumes:
- "./services/users:/usr/src/app"
ports:
- 5001:5000
environment:
- FLASK_APP=project/__init__.py
- FLASK_ENV=development
- APP_SETTINGS=project.config.DevelopmentConfig
- DATABASE_URL=postgres://postgres:postgres@users-db:5432/users_dev
- DATABASE_TEST=postgres://postgres:postgres@users-db:5432/users_test
depends_on:
- users-db
users-db:
build:
context: ./services/users/project/db
dockerfile: Dockerfile
ports:
- 5432:5432
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
и мой файл докера:
FROM python:3.6.5-alpine
RUN apk update && \
apk add --virtual build-deps gcc python-dev musl-dev && \
apk add postgresql-dev && \
apk add netcat-openbsd
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY ./requirements.txt /usr/src/app/requirements.txt
RUN pip install -r requirements.txt
COPY ./entrypoint.sh /usr/src/app/entrypoint.sh
RUN chmod +x /usr/src/app/entrypoint.sh
COPY . /usr/src/app
CMD ["/usr/src/app/entrypoint.sh"]
и последующая точка входа .sh:
#!/bin/sh
echo "Waiting for postgres..."
while ! nc -z users-db 5432; do
sleep 0.1
done
echo "PostgresSQL started"
python manage.py run --host 0.0.0.0