The volume set by the docker is not set correctly

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

# set working directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

# add requirements (to leverage Docker cache)
ADD ./requirements.txt /usr/src/app/requirements.txt

# install requirements
RUN pip install -r requirements.txt

# add app
ADD . /usr/src/app

# run server
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",
        ...
+4

Source: https://habr.com/ru/post/1683152/


All Articles