I follow the tutorial on the jar / Dockers at testdriven.io . In the first part of the third section of Docker Config, I follow the instructions to mount the project directory as volumes in the docker container for development. Unfortunately, following the instructions in the tutorial, you do not correctly mount the volume using docker-compose. Instead, the directory inside the container is empty.
Below is the Docker file for the container in question.
FROM python:3.6.1
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
ADD ./requirements.txt /usr/src/app/requirements.txt
RUN pip install -r requirements.txt
ADD . /usr/src/app
CMD python manage.py runserver -h 0.0.0.0
And this is the docker-compose.yml file
version: '2.1'
services:
users-service:
container_name: users-service
build: .
volumes:
- '.:/usr/src/app'
ports:
- 5001:5000 # expose ports - HOST:CONTAINER
This directory is the directory / usr / src / app inside the users-service container. When I do this:
>> docker-compose build
>> docker-compose up -d
>> docker-compose run users-service bash
ls , (/usr/src/app), . CMD, manage.py, .
, , . - . , .
EDIT:
docker inspect , , Mounts Config - Volume:
"Mounts": [
{
"Type": "bind",
"Source": "/home/jonathan/projects/flask-microservices-users",
"Destination": "/usr/src/app",
"Mode": "rw",
"RW": true,
"Propagation": "rprivate"
}
],
...
"Config": {
...
"Image": "flaskmicroservicesusers_users-service",
"Volumes": {
"/usr/src/app": {}
},
"WorkingDir": "/usr/src/app",
...