docker icon indicating copy to clipboard operation
docker copied to clipboard

entrypoint.sh www-data UID/GID issue?

Open Mist-Hunter opened this issue 4 years ago • 1 comments

Fresh install, docker-compose (yaml below). In the 'web' container, I never see: "The user ${APACHE_RUN_USER} does not exist, creating..." from entrypoint.sh and get the following inside the container:

root@3221c76738f7:/var/www/html# id -u www-data
33
root@3221c76738f7:/var/www/html# id -g www-data
33
root@3221c76738f7:/var/www/html# echo $APACHE_RUN_USER_ID
1000
root@3221c76738f7:/var/www/html# echo $APACHE_RUN_GROUP_ID
1000
root@3221c76738f7:/var/www/html# apachectl -t -D DUMP_RUN_CFG
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.3. Set the 'ServerName' directive globally to suppress this message
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex default: dir="/var/run/apache2/" mechanism=default 
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
Mutex rewrite-map: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33

I might easily just be confused, and all this expected. But the entrypoint.sh seems to indicate that id -u www-data should equal $APACHE_RUN_USER_ID.

Is it possible that the default apache user is created earlier in the dockerfile and that the following are needed?:

usermod -u $APACHE_RUN_USER_ID www-data
groupmod -g $APACHE_RUN_GROUP_ID www-data

Sorry if I'm way off track here. Thanks for the software. For my needs, I can't find anything else like it. This is probably unrelated, but I'm having issues with random images not loading until I hit the refresh button. Said images are accessed via a CIFs share mounted in the Docker host. I know this is not normal and maybe not supported, but I was double checking permissions when finding all this (which may be nothing).

version: '3.5'

services:
  db:
    image: mariadb:10.1
    container_name: FileRun-MariaDB-Dev
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
      MYSQL_USER: ${MYSQL_USER}
      MYSQL_PASSWORD: ${MYSQL_PASSWORD}
      MYSQL_DATABASE: ${MYSQL_DATABASE}
    volumes:
      - "/base/docker/filerun-dev/db:/var/lib/mysql"
  web:
    image: afian/filerun:latest
    container_name: FileRun-Dev
    environment:
      FR_DB_HOST: db
      FR_DB_PORT: 3306
      FR_DB_NAME: ${MYSQL_DATABASE}
      FR_DB_USER: ${MYSQL_USER}
      FR_DB_PASS: ${MYSQL_PASSWORD}
      APACHE_RUN_USER: www-data
      APACHE_RUN_USER_ID: 1000
      APACHE_RUN_GROUP: www-data
      APACHE_RUN_GROUP_ID: 1000
    depends_on:
      - db
    links:
      - db:db
    ports:
      - "2021:80"
    volumes:
      - "/base/docker/filerun-dev/html:/var/www/html"  
      - "/base/docker/filerun-dev/user-files:/user-files"

networks:
  default:
    external:
      name: Filerun-Dev

Mist-Hunter avatar Oct 06 '21 14:10 Mist-Hunter

Maybe relevant? https://github.com/docker-library/php/issues/14#issuecomment-238248285

Mist-Hunter avatar Oct 06 '21 15:10 Mist-Hunter