Это основано на https://testdriven.io/courses/microservices-with-docker-flask-and-react/
Я запускаю файл Docker, который будет указывать на entrypoint.sh.
docker-compose-f docker-compose-dev.yml build run
успешно
Но бег docker-compose-f docker-compose-dev.yml up
показывает
ERROR: for users Cannot start service users: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"/usr/src/app/entrypoint.sh\": permission denied": unknown
ERROR: Encountered errors while bringing up the project.
Я попытался запустить в интерактивном режиме с docker run -it –tty users_app:latest sh
.
Запуск ./entrypoint.sh
сработал.
Но это не сработало с docker-compose.
У кого-нибудь есть такая же проблема?
Это мой docker-compose-dev.yml, Dockerfile-dev и entrypoint.sh
докер-Compose-dev.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_URL=postgres://postgres:postgres@users-db:5432/users_test
depends_on:
- users-db
users-db:
build:
context: ./services/users/project/db
dockerfile: Dockerfile
ports:
- 5435:5432
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
Dockerfile-DEV
# base image
FROM python:3.6.5-alpine
# install dependencies
RUN apk update && \
apk add --virtual build-deps gcc python-dev musl-dev && \
apk add postgresql-dev && \
apk add netcat-openbsd
# set working directory
WORKDIR /usr/src/app
# add and install requirements
COPY ./requirements.txt /usr/src/app/requirements.txt
RUN pip install -r requirements.txt
# add app
COPY . /usr/src/app
# add entrypoint.sh
COPY ./entrypoint.sh /usr/src/app/entrypoint.sh
RUN chmod +x /usr/src/app/entrypoint.sh
# run server
#USER root
#RUN ["chmod", "+x", "/usr/src/app/entrypoint.sh"]
CMD ["/usr/src/app/entrypoint.sh"]
entrypoint.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 -h 0.0.0.0