Docker-compose does not see volume changes in docker-compose.yml

I am working with docker-compose.

My docker-compose.yml looks like

redis: image: redis expose: - "6379" volumes: - ./redis:/data nerdzcrush: image: nerdzeu/docker-nerdzcrush ports: - "8181:81" links: - redis volumes: - ./mediacrush:/home/mediacrush 

When I run docker-compose up everything works fine.

After that I needed to change the mount path. I stopped the containers with docker-compose stop , I changed my docker-compose.yml file as follows:

 redis: image: redis expose: - "6379" volumes: - ./nerdzcrush/redis:/data nerdzcrush: image: nerdzeu/docker-nerdzcrush ports: - "8181:81" links: - redis volumes: - ./nerdzcrush/mediacrush:/home/mediacrush 

And I deleted the old directories using

 sudo rm -rf ./mediacrush ./redis 

After that I started containers with docker-compose up -d

I expect the containers to start working with the new path, but I see that the old path is being used. So I have it again. / mediacrush and. / redis in my folder.

Did I misunderstand something about docker composing or that there was a problem with docker layout?

I am using docker version: 1.5.0dev

thanks

+5
source share
1 answer

It should only save volumes if they are container data volumes (not host volumes, as in your case).

I would try running docker-compose rm to remove the containers (after stopping them). After that, up should use the correct path.

+3
source

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


All Articles