question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

can't run docker compose with mongo and mounted volume

See original GitHub issue

Actual 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

  1. docker-compose.yaml:
version: '2'
services:
  mongo:
    image: mongo:3.4.23
    container_name: db
    volumes:
      - "./data:/data/db"
  1. 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:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7

github_iconTop GitHub Comments

2reactions
rafaribecommented, Mar 9, 2022

Same here

Error response from daemon: error while creating mount source path './data/logs': chown ./data/logs: permission denied

MacOS Monterey 12.2.1

1reaction
hguerrerocommented, Jun 14, 2022

Closing as duplicate of #1209

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found