Docker: Check the Privacy Configuration if you use Docker on macOS Catalina 10.15

The Docker can mount the folder in host OS to share with container. This article says check points if this function doesn’t work fine.

The running environment of this article is macOS Catalina 10.15.

When the host OS is macOS, the privacy settings also needed to be checked.


I have been using the web server which is running on the docker container to develop. The content files are in the folder which is shared with the container, because I want to edit them quickly.

The configuration file of the Docker Composer is following:

version: "3"
    build: .
      - 80:80
      - ./content_home:/usr/share/nginx/html

I ran this container and access it, but the web browser said 404 Not Found error.

When I move the folder contains files including docker-compose.yml to another location, the container works fine.

What You Should Check

This is a checklist for this situation.

  • Is /usr/share/nginx/html exists?
  • Can you see the contents of /usr/share/nginx/html ?
  • Is ./content_home exists in host OS?
  • Does docker has rights such as permission to the ./content_home in host OS?

Check the Container

Check the /usr/share/nginx/html in the container.

$ docker container exec testserver_nginx_1 ls /usr/share/nginx

The html is output so the html is exists. Next, check the contents.

$ docker container exec testserver_nginx_1 ls /usr/share/nginx/html
ls: cannot open directory '/usr/share/nginx/html': Operation not permitted

I couldn’t access to the contents of the folder, it seems that the docker doesn’t have the permission to the shared folder.

Check the Host

Check the folder is exists and a permission. It is easy with the Finder. Select the folder and choose “Get Info” from the “File” menu. Check the “Sharing & Permissions”.

It is fine if me is “Read & Write”, “staff” is “Read only” and “everyone“ is “Read only”.

And my OS, no problem.

Privacy Configuration

On macOS, the following three folders need to be given permission for each application.

  • Downloads
  • Documents
  • Desktop

When you first time to access these folders, the macOS will prompt to get the permission. If you didn’t allow in this dialog, the application can’t to access.

You can check or change the configuration by following steps:

  1. Choose “System Preferences…” from Apple menu.
  2. Click the “Security & Privacy”.
  3. Select the “Privacy” tab.
  4. Select the “Files and Folders”.

The checkbox of the “Desktop Folder” was unchecked.

I worked in the Desktop folder.

I don’t remember, but they seemed to have removed it.

Sponsored Links
Get the Latest News !

Developer ToolsLatest 8 Posts