前提・実現したいこと
docker-compose upコマンドでphpmyadinコンテナを立ち上げる際に以下のエラーが発生し、コンテナが作られないです。
発生している問題・エラーメッセージ
H00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.2. Set the 'ServerName' directive globally to suppress this message
該当のソースコード
docker-compose.yml
version: '2' services: phpmyadmin: image: phpmyadmin/phpmyadmin container_name: phpmyadmin environment: - PMA_HOST=localhost - PMA_USER=root - PMA_PASSWORD=root ports: - "8080:80" networks: default: external: name: common_link
Dockerfile(こちら下記のDocerfileそのままコピペしています)
https://hub.docker.com/r/phpmyadmin/phpmyadmin/dockerfile
FROM php:7.4-apache # Install dependencies RUN set -ex; \ \ savedAptMark="$(apt-mark showmanual)"; \ \ apt-get update; \ apt-get install -y --no-install-recommends \ libbz2-dev \ libfreetype6-dev \ libjpeg-dev \ libpng-dev \ libwebp-dev \ libxpm-dev \ libzip-dev \ ; \ \ docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp --with-xpm; \ docker-php-ext-install -j "$(nproc)" \ bz2 \ gd \ mysqli \ opcache \ zip \ ; \ \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark; \ ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ | awk '/=>/ { print $3 }' \ | sort -u \ | xargs -r dpkg-query -S \ | cut -d: -f1 \ | sort -u \ | xargs -rt apt-mark manual; \ \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ rm -rf /var/lib/apt/lists/* # set recommended PHP.ini settings # see https://secure.php.net/manual/en/opcache.installation.php ENV MAX_EXECUTION_TIME 600 ENV MEMORY_LIMIT 512M ENV UPLOAD_LIMIT 2048K RUN set -ex; \ \ { \ echo 'opcache.memory_consumption=128'; \ echo 'opcache.interned_strings_buffer=8'; \ echo 'opcache.max_accelerated_files=4000'; \ echo 'opcache.revalidate_freq=2'; \ echo 'opcache.fast_shutdown=1'; \ } > $PHP_INI_DIR/conf.d/opcache-recommended.ini; \ \ { \ echo 'session.cookie_httponly=1'; \ echo 'session.use_strict_mode=1'; \ } > $PHP_INI_DIR/conf.d/session-strict.ini; \ \ { \ echo 'allow_url_fopen=Off'; \ echo 'max_execution_time=${MAX_EXECUTION_TIME}'; \ echo 'max_input_vars=10000'; \ echo 'memory_limit=${MEMORY_LIMIT}'; \ echo 'post_max_size=${UPLOAD_LIMIT}'; \ echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \ } > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini # Calculate download URL ENV VERSION 5.0.4 ENV SHA256 1578c1a08e594da4f4f62e676ccbdbd17784c3de769b094ba42c35bf05c057db ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz LABEL org.opencontainers.image.title="Official phpMyAdmin Docker image" \ org.opencontainers.image.description="Run phpMyAdmin with Alpine, Apache and PHP FPM." \ org.opencontainers.image.authors="The phpMyAdmin Team <developers@phpmyadmin.net>" \ org.opencontainers.image.vendor="phpMyAdmin" \ org.opencontainers.image.documentation="https://github.com/phpmyadmin/docker#readme" \ org.opencontainers.image.licenses="GPL-2.0-only" \ org.opencontainers.image.version="${VERSION}" \ org.opencontainers.image.url="https://github.com/phpmyadmin/docker#readme" \ org.opencontainers.image.source="https://github.com/phpmyadmin/docker.git" # Download tarball, verify it using gpg and extract RUN set -ex; \ \ savedAptMark="$(apt-mark showmanual)"; \ \ apt-get update; \ apt-get install -y --no-install-recommends \ gnupg \ dirmngr \ ; \ \ export GNUPGHOME="$(mktemp -d)"; \ export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \ curl -fsSL -o phpMyAdmin.tar.xz $URL; \ curl -fsSL -o phpMyAdmin.tar.xz.asc $URL.asc; \ echo "$SHA256 *phpMyAdmin.tar.xz" | sha256sum -c -; \ gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPGKEY" \ || gpg --batch --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$GPGKEY" \ || gpg --batch --keyserver keys.gnupg.net --recv-keys "$GPGKEY" \ || gpg --batch --keyserver pgp.mit.edu --recv-keys "$GPGKEY" \ || gpg --batch --keyserver keyserver.pgp.com --recv-keys "$GPGKEY"; \ gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \ tar -xf phpMyAdmin.tar.xz -C /var/www/html --strip-components=1; \ mkdir -p /var/www/html/tmp; \ chown www-data:www-data /var/www/html/tmp; \ gpgconf --kill all; \ rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \ rm -rf /var/www/html/setup/ /var/www/html/examples/ /var/www/html/test/ /var/www/html/po/ /var/www/html/composer.json /var/www/html/RELEASE-DATE-$VERSION; \ sed -i "s@define('CONFIG_DIR'.*@define('CONFIG_DIR', '/etc/phpmyadmin/');@" /var/www/html/libraries/vendor_config.php; \ \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ rm -rf /var/lib/apt/lists/* # Copy configuration COPY config.inc.php /etc/phpmyadmin/config.inc.php # Copy main script COPY docker-entrypoint.sh /docker-entrypoint.sh ENTRYPOINT [ "/docker-entrypoint.sh" ] CMD ["apache2-foreground"] RUN echo "ServerName localhost" | tee /etc/apache2/conf-available/fqdn.conf RUN a2enconf fqdn
試したこと
Dockerfileに以下を追記(参考 https://qiita.com/sachiko-kame/items/a6deebbad207d627b598)
RUN echo "ServerName localhost" | tee /etc/apache2/conf-available/fqdn.conf RUN a2enconf fqdn
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。