mount files present in a directory in docker image with the directory in the host

I have a docker image in which there are few configuration files present in the directory /opt/app/config now i wanted to mount this directory to a host directory so that config files can be accessed from host.

my docker compose is a follows

    image: web:v1
    container_name: web
      - ./config:/opt/app/config
    command: ["tail","-f","/dev/null"]
      - 5000:5000

if i run the individual web image using docker run -it web:v1 bash and do ls /opt/app/config i can see the config files

but using docker-compose upthe containers are getting created but the files are not being reflected in the host path.

when i do ls ./config the directory is empty. The expected behaviour is the files present in docker image at /opt/app/config shloud be reflected in my host ./config directory.

Source: StackOverflow