Understanding Docker Mounting and Volume Conflicts with Hosts

Asked 3 months ago, Updated 3 months ago, 13 views

I apologize for the abstraction, but I would like you to tell me about the behavior of the following cases.
Folder B does not appear on the host side when the container is started in the following state:
Please tell me why folder B is not displayed.

DDockerfile
·Copy folder A of the host into the container
·Create a new folder B in folder A of the container and create files under the control

ddocker-compose.yml
In the docker-compose.yml file, mount folder A on the host and folder A that you copied into the container, and save folder B that you created in the container to the top volume (vol1).
Here is a simple example:

 volumes:
    - path_to_folder A —path_to_folder A (in the container)
    - vol1: path_to_folder B (in container)

volumes:
  vol1:

docker docker-compose docker-for-mac

2022-09-30 11:29

1 Answers

A is a special setting called bind mount that links the file system on the host side and the container side.Use this tool to save and retrieve logs and images of Web servers and applications.

B is a setting called Docker Volume that perpetuates data to abstracted storage in Docker, so you can use it when you do not view files directly from the host file system (for example, to store database information).


2022-09-30 11:29

If you have any answers or tips


© 2023 OneMinuteCode. All rights reserved.