Volume on host – permission denied for Postgres (Mac OS)

I am starting Postgresql image with following volume


According to docker docs it should work as docker should have access to /Users directory on Mac OS. After creating & runing container I can see
that empty directory /Users/me/Desktop/volumes/postgresql/data is created however Postgres does not start and show these lines in log:

  • Permission denied in a Docker container even if user has the rights
  • Terminate docker compose when test container finishes
  • Fail over with Docker Compose, two approaches
  • Customize docker-java response to remove some logger like stream
  • Redis server does not start after install in Docker
  • What's the fastest way to migrate from boot2docker to Vagrant+NFS on Mac OS X?
  • could not create directory "/var/lib/postgresql/data/global": Permission denied

    What I am doing wrong?

  • PDOException SQLSTATE[HY000] [2002] No such file or directory. Whilst running laravel via isolated docker containers
  • Redis Sentinel manual failover command timesout
  • Docker cloud service link for Ruby on Rails application
  • Monitoring changes at mounted a host directory from Docker container
  • Docker cannot establish connection with postgresql in Travis CI
  • Kafka Endless NotLeaderForPartitionException for ReplicaFetcherThread
  • 2 Solutions collect form web for “Volume on host – permission denied for Postgres (Mac OS)”

    Your directory belongs to a different User then the user, that the User that executes the container.

    Could you change your directory like that for a start.

    chmod 777 /Users/me/Desktop/volumes/postgresql/data

    If you can start your container with this setting, then this missing permissions are the root cause.

    You could then try to start your container with

    run -u uid ...

    and specify the userid of your user on macos.
    You have to create the user in boot2docker too, i.e.

    boot2docker ssh
    sudo sh
    adduser <anyuserid> -u <your uid>

    I had the same problem.

    What I done was the workaround by creating the folder inside the Virtual Box.

    Set your docker-compose.yml postgresql folder:




    Enter at the Docker at Virtual Box and create the data folder

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.