Контейнеру Docker LAMP запрещено разрешение MySQLApache

Ответить Пред. темаСлед. тема
Anonymous
 Контейнеру Docker LAMP запрещено разрешение MySQL

Сообщение Anonymous »


I have a LAMP server configured in docker for local development. It was an Ubuntu 16, Apache, PHP 7.2, MySQL 5.6 setup, so I can run something like this:

docker run -d -p 80:80 -v ${PWD}:/app --name website_test lamp-server:latest

I'm trying to upgrade it to Ubuntu 22, PHP 8, MySQL 8.0. Here is part of the Dockerfile:

FROM ubuntu:jammy MAINTAINER Ray Hwang # Install packages ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ apt-get -y install libaio1 libaio-dev supervisor git apache2 curl mysql-server php libapache2-mod-php8.0 php-mbstring php-mysql php-curl php-gd && \ echo "ServerName localhost" >> /etc/apache2/apache2.conf # Add image configuration and scripts ADD docker/start-apache2.sh /start-apache2.sh ADD docker/start-mysqld.sh /start-mysqld.sh ADD docker/mysql-setup.sh /mysql-setup.sh ADD docker/run.sh /run.sh RUN chmod 755 /*.sh ADD docker/my.cnf /etc/mysql/conf.d/my.cnf ADD docker/supervisord-apache2.conf /etc/supervisor/conf.d/supervisord-apache2.conf ADD docker/supervisord-mysqld.conf /etc/supervisor/conf.d/supervisord-mysqld.conf # Add MySQL utils RUN usermod -d /var/lib/mysql/ mysql # config to enable .htaccess ADD docker/apache_default /etc/apache2/sites-available/000-default.conf RUN a2enmod rewrite # Configure /app folder RUN mkdir -p /app && rm -fr /var/www/html && ln -s /app /var/www/html #Environment variables to configure php ENV PHP_UPLOAD_MAX_FILESIZE 128M ENV PHP_POST_MAX_SIZE 128M # Add volumes for MySQL VOLUME ["/etc/mysql", "/var/lib/mysql", "/app" ] EXPOSE 80 3306 CMD ["/run.sh"] After building the image, everything seems to work fine, except connecting to MySQL through Apache.

Here is what does work:
  • Connecting to MySQL via CLI
    $ mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 22 Server version: 8.0.36-0ubuntu0.22.04.1 (Ubuntu) Copyright (c) 2000, 2024, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
  • Connecting use PHP from CLI $ cat test.php

    Источник: https://stackoverflow.com/questions/780 ... ion-denied
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «Apache»