The process of log rotation for RunCloud docker servers is slightly different from the standard Nginx log rotation. This is because RunCloud docker servers use a custom configuration file for Nginx, which is located inside the container.
To configure log rotation in Docker servers, you need to log in to your server with superuser permission and then execute the following command to get the container id of your Nginx container:
docker ps -qf "name=runcloud_nginx-rc*"
In the above screenshot, the container ID is ec753de065e3
. We will now use this ID in the following command to execute statements inside the Nginx container.
Replace the <container id>
with the output from the previous command to enter the container:
docker exec -it <container id> bash
Once you enter the container, a new line will start with root@NGINX-RC-CONTAINER
. This signifies that all the commands will now be executed directly inside the container.
Now you can move to the /etc/logrotate.d
directory inside your container and edit the configuration files as you need. You can refer to our logrotation for Nginx post for more information.