Skip to content

Non-root container and APACHE_DISABLE_REWRITE_IP cause "Could not remove /etc/apache2/conf-enabled/remoteip.conf: Permission denied" #1494

@spikeygg

Description

@spikeygg

I've been trying to get this image working and I've run into a snag. I want to use my own account internally so that the files created by the docker are owned and manageable by my user so I've included the user directive in the docker-compose. However, I also need to use the APACHE_DISABLE_REWRITE_IP environment keyword to make the docker work in my network topology. I have found that when I use the user directive and the APACHE_DISABLE_REWRITE_IP=1 environment definition the docker container fails to start only reporting this log entry:

Could not remove /etc/apache2/conf-enabled/remoteip.conf: Permission denied
Could not remove /etc/apache2/conf-enabled/remoteip.conf: Permission denied
Could not remove /etc/apache2/conf-enabled/remoteip.conf: Permission denied
... and so on

Here is what my simplified docker-compose looks like:

version: '2.1'

services:
  app:
    hostname: nc_machine
    container_name: nextcloud
    image: nextcloud
    restart: unless-stopped
    sysctls:
      - net.ipv4.ip_unprivileged_port_start=0
    user: 1000:100
    ports:
      - 8081:80
    volumes:
      - /vol/nextcloud/www_html:/var/www/html
      - /vol/nextcloud/photos:/photos
    environment:
      - APACHE_DISABLE_REWRITE_IP=1
      - TRUSTED_PROXIES=192.168.10.6

If I comment out either the user: 1000:100 OR the - APACHE_DISABLE_REWRITE_IP=1 the docker container starts up fine.

I found some instances where people were using APACHE_RUN_USER and APACHE_RUN_GROUP but defining those didn't seem to help.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions