1. Update your docker mounts, add this line into volumes mount list:
  - /var/log/nginx:/var/log/nginx
  1. Restart the container. Make sure that /var/log/nginx has access.log and error.log files (if you didn’t forget to specify them in the nginx.conf).

  2. Tune your logrotate. I assume, you’re using standard logrotate package. Here I use just docker, but I highly recommend to use full path to the docker binary. Create new logrotate config like this, replacing NAME-OF_MY-IMAGE by actual name. Or run docker ps and look into the second column.

/var/log/nginx/*.log {
  compress
  missingok
  nocopytruncate
  delaycompress
  nomail
  notifempty
  noolddir
  dateext
  rotate 5
  sharedscripts
  size=10M
  postrotate
    docker exec -t $(docker ps | awk '/NAME-OF-MY-IMAGE/ {print $1}') nginx -s reopen
  endscript
}

OK! It should work now!