Why do volumes in docker-compose rub the directory inside the container?

version: ‘3’

services:
web:
image: test/vitrina_20:$VITRINA_RELEASE
command: [’./init.sh’]
volumes:

  • /var/www/html/vitrina_20/static:/code/static

ports:

  • “8001:8000”
    environment:
  • DATANRM_URL
  • DATANRM_USER
  • DATANRM_PASS

There is a docker-compose file.

  1. Why does the contents of the static folder inside the container get erased when I run the docker-compose.yml file?
  2. How to make the contents of the / code / static folder as it exists in the container was forwarded to the / var / www / html / vitrina_20 / static folder on the host system?

hey @impkos
please check this thread

I don’t think it gets erased, it just gets invisible because you mount another drive into /code/static. If you need this content on your external folder it should be located at another place in the container. Then you can add an entrypoint script that copies or rsyncs it to the volume on startup.