Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/mysql_init.sh: Permission denied #140

Open
julienberton opened this issue May 27, 2024 · 1 comment
Open

/mysql_init.sh: Permission denied #140

julienberton opened this issue May 27, 2024 · 1 comment

Comments

@julienberton
Copy link

julienberton commented May 27, 2024

Hello,

As I was trying to use the 2004-php8 version, MySQL init script is failing with a permission denied error (logs below).

PS C:\Users\julie> docker run -p "80:80" -v ${PWD}/Downloads/app:/app mattrayner/lamp:latest-2004-php8
WARNING: The requested image's platform (linux/arm64) does not match the detected host platform (linux/amd64/v3) and no specific platform was requested
Updating for PHP 8.0
Replacing CLI php.ini values
Editing APACHE_RUN_GROUP environment variable
Editing phpmyadmin config
Setting up MySQL directories
Allowing Apache/PHP to write to the app
Allowing Apache/PHP to write to MySQL
Editing MySQL config
=> An empty or uninitialized MySQL volume is detected in /var/lib/mysql
=> Installing MySQL ...
=> Done!
/run.sh: line 109: /mysql_init.sh: Permission denied
Starting supervisord
2024-05-27 08:29:50,056 CRIT Supervisor is running as root.  Privileges were not dropped because no user is specified in the config file.  If you intend to run as root, you can set user=root in the config file to avoid this message.
2024-05-27 08:29:50,060 INFO Included extra file "/etc/supervisor/conf.d/supervisord-apache2.conf" during parsing
2024-05-27 08:29:50,062 INFO Included extra file "/etc/supervisor/conf.d/supervisord-mysqld.conf" during parsing
2024-05-27 08:29:50,102 INFO RPC interface 'supervisor' initialized
2024-05-27 08:29:50,103 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2024-05-27 08:29:50,106 INFO supervisord started with pid 1
2024-05-27 08:29:51,127 INFO spawned: 'apache2' with pid 117
2024-05-27 08:29:51,149 INFO spawned: 'mysqld' with pid 119
2024-05-27 08:29:52,732 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-05-27 08:29:52,733 INFO success: mysqld entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

After investigating, it seems that the script is missing run permissions, a command like : chmod +x /mysql_init.sh seems to fix it in the shell of the container.

@pzhlkj6612
Copy link
Contributor

Hi, @julienberton!

After investigating, it seems that the script is missing run permissions, a command like : chmod +x /mysql_init.sh seems to fix it in the shell of the container.

Good catch!

# Add image configuration and scripts
ADD supporting_files/start-apache2.sh /start-apache2.sh
ADD supporting_files/start-mysqld.sh /start-mysqld.sh
ADD supporting_files/run.sh /run.sh
RUN chmod 755 /*.sh
ADD supporting_files/supervisord-apache2.conf /etc/supervisor/conf.d/supervisord-apache2.conf
ADD supporting_files/supervisord-mysqld.conf /etc/supervisor/conf.d/supervisord-mysqld.conf
ADD supporting_files/supervisord.conf /etc/supervisor/supervisord.conf
# Remove pre-installed database
RUN rm -rf /var/lib/mysql
# Add MySQL utils
ADD supporting_files/mysql_init.sh /mysql_init.sh

It should be:

  # Add image configuration and scripts 
  ADD supporting_files/start-apache2.sh /start-apache2.sh 
  ADD supporting_files/start-mysqld.sh /start-mysqld.sh 
  ADD supporting_files/run.sh /run.sh 
+ # Add MySQL utils 
+ ADD supporting_files/mysql_init.sh /mysql_init.sh 
  RUN chmod 755 /*.sh 
 
  ...
 
- # Add MySQL utils 
- ADD supporting_files/mysql_init.sh /mysql_init.sh 

I don't know why this script worked fine in previous releases... I didn't encounter this issue.


@mattrayner ,

Here we have the warning:

WARNING: The requested image's platform (linux/arm64) does not match the detected host platform (linux/amd64/v3) and no specific platform was requested

Is this related to #139 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants