-1

I ran a metabase container using the command:

docker run -d -p 8000:3001 -v metabase-data:/metabase-data -v ~/metabase-plugins:/plugins -e "MB_DB_FILE=/metabase-data" --name metabase-main metabase/metabase

Afterward, I used docker cp to copy some custom files to folders /metabase-data/ and /plugins/ inside the container. Those 2 folders were previously empty.

Finally, I ran another metabase container using almost the same command, only the ports and container name are different:

docker run -d -p 8001:3002 -v metabase-data:/metabase-data -v ~/metabase-plugins:/plugins -e "MB_DB_FILE=/metabase-data" --name metabase-test metabase/metabase

When I check the folders /metabase/ and /plugins/ inside the new container (metabase-test), they also contain the same custom files, just like in the previous container (metabase-main).

How is that even possible?

Mike Abbey
  • 167
  • 1
  • 9

1 Answers1

1

Well, this is happening because of two things. First, you are using both docker volumes (-v metabase-data:/metabase-data) and bind mounts -v ~/metabase-plugins:/plugins, notice the ~, which points to your home directory. With bind mounts, you are mounting a local folder to a docker container. In other words, anything that is at the start of the docker container inside the mounted folder ~/metabase-plugins would be in the container. Since you copied the files to that folder, the items are present in the second container as well.

Now, for the /metabase/ folder, you are using a docker volume. Docker volume is made specifically to persist data, since the two images are the same and in both container you mounted the same volume, the same data would exist inside. (it would also work if the images would not be the same)

Pavol Krajkovič
  • 505
  • 1
  • 12