From container to host

Is it possible to mount a file or directory from the container to the host? For example, what should I do if I need the Nginx log files real-time?

Thank you.

Yes, that would be a bind mount
It generally follows this pattern: hostpath:containerpath:permissions

Using docker run

docker run -v /host/mount/path:/container/mount/path image [command]

Using docker compose:

    image: some/image:latest
      - /host/mount/path:/container/mount/path
      # - hostpath:containerpath:permissions

Using Docker Desktop, the paths can be selected within the Optional settings window upon starting a new container

For nginx, I believe the default log path (Assuming it is enabled) is /var/log/nginx