can't run docker compose with mongo and mounted volume
See original GitHub issueActual Behavior
When trying to run a docker-compose file that uses mongo db with a mounted volume (for persisting data). The volume is mounted in a way that does not allow the container to execute chown.
Steps to Reproduce
- docker-compose.yaml:
version: '2'
services:
mongo:
image: mongo:3.4.23
container_name: db
volumes:
- "./data:/data/db"
- run
docker compose up -d
Result
[+] Running 1/0
⠿ Container db Recreated 0.0s
Attaching to db
db | chown: changing ownership of '/data/db': Permission denied
Expected Behavior
container runs correctly
Additional Information
No response
Rancher Desktop Version
1.0.1
Rancher Desktop K8s Version
1.23.3
Which container runtime are you using?
moby (docker cli)
What operating system are you using?
macOS
Operating System / Build Version
macOS Big Sur 11.6.3
What CPU architecture are you using?
x64
Linux only: what package format did you use to install Rancher Desktop?
No response
Windows User Only
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7
Top Results From Across the Web
docker-compose with MongoDb and volumes - doesn't ...
To check if the mount has taken place, do a docker exec mongo bash , to open a bash in that container and...
Read more >Can't mount mongodb directory volume with docker-compose ...
[Solved]-Can't mount mongodb directory volume with docker-compose-mongodb ... If you're using Docker Toolbox for OSX then only the home directory is available to ......
Read more >Volumes
If you start a container with a volume that doesn't yet exist, Docker creates the volume for you. The following example mounts the...
Read more >Using MongoDB with Docker - Earthly Blog
These containers can be run on any machine, as well as in a . ... a container test-mongo with a Docker volume named...
Read more >How To Run MongoDB as a Docker Container
These kinds of mappings are known as bind-mount volumes. ... Go to the “mongodb” folder and run the docker-compose up command to start...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Same here
MacOS Monterey 12.2.1
Closing as duplicate of #1209