I’m trying to understand the difference between these 2 commands
docker volume create --driver local \ --opt type=none \ --opt device=$(pwd)/config\ --opt o=bind \ config_vol docker run -it --volume config_vol:/app/config
docker run -it --volume $(pwd)/config:/app/config
I understand that a volume is a stateful entity, but what confuses me is that if my config folder is empty initially when running the docker with a pre-created volume, it copies the contents of the container into the config folder which is desired behavior, but the second command hides the contents of the container and treats it as an empty folder in the container.
That is, after running the docker containers, in the first situation if I ran
ls /app/config in the interactive terminal, I’d see
config.json in the output, but in the second situation I’d see nothing.
Why is that?