dockerでphpmyadminのブラウザ表示がされない
dockerでnginxとmysqlとphpmyadminを起動させたいのですが、phpmyadminだけブラウザの表示しません。
docker-compose psで見た可動状況
Name Command State Ports ------------------------------------------------------------------------------------------------------------- practice-phpmyadmin_db_1 docker-entrypoint.sh mysqld Up 0.0.0.0:3306->3306/tcp, 33060/tcp practice-phpmyadmin_phpmyadmin_1 /docker-entrypoint.sh php-fpm Up 0.0.0.0:8888->8080/tcp, 9000/tcp practice-phpmyadmin_web_1 /docker-entrypoint.sh ngin ... Up 0.0.0.0:80->80/tcp
### ファイル構成 - docker-compose.yml - .env - mysql - Dockerfile - my.cnf - nguni - Dockerfile - defat.conf ### 該当のソースコード docker-compose.yml version: "3.8" volumes: db-store-hogehoge: # php-fpm-socket: php-practice-hogehoge: pma-hogehoge: services: web: build: ./nginx ports: - 80:80 volumes: - php-practice-hogehoge:/var/run/php-fpm - ../backend:/work/backend db: build: ./mysql volumes: - db-store-hogehoge:/var/lib/mysql ports: - 3306:3306 phpmyadmin: image: phpmyadmin/phpmyadmin:fpm ports: - 8888:8080 environment: - PMA_HOST=laravel_local - PMA_PORT=3306 # - PMA_ABSOLUTE_URI=http://localhost/phpmyadmin volumes: - pma-hogehoge:/sessions depends_on: - db
mysql/Dockerfile
FROM mysql:8.0 ENV TZ=UTC \ MYSQL_DATABASE=laravel_local \ MYSQL_USER=phper \ MYSQL_PASSWORD=secret \ MYSQL_ROOT_PASSWORD=secret COPY ./my.cnf /etc/my.cnf
mysql/my.cnf
[mysqld] character_set_server = utf8mb4 collation_server = utf8mb4_0900_ai_ci # timezone default-time-zone = SYSTEM log_timestamps = SYSTEM # Error Log log-error = mysql-error.log # Slow Query Log slow_query_log = 1 slow_query_log_file = mysql-slow.log long_query_time = 1.0 log_queries_not_using_indexes = 0 # General Log general_log = 1 general_log_file = mysql-general.log [mysql] default-character-set = utf8mb4 [client] default-character-set = utf8mb4
nginx/Dockerfile
FROM node:14.11.0-alpine as node FROM nginx:1.19.2-alpine SHELL ["/bin/ash", "-oeux", "pipefail", "-c"] ENV TZ=UTC RUN apk update && \ apk add --update --no-cache --virtual=.build-dependencies g++ # node command COPY --from=node /usr/local/bin /usr/local/bin # npm command COPY --from=node /usr/local/lib /usr/local/lib # yarn command COPY --from=node /opt /opt # nginx config file COPY ./default.conf /etc/nginx/conf.d/default.conf WORKDIR /work/backend
nginx/default.cnf
access_log /dev/stdout main; error_log /dev/stderr warn; server { listen 80; root /work/backend/public; add_header X-Frame-Options "SAMEORIGIN"; add_header X-XSS-Protection "1; mode=block"; add_header X-Content-Type-Options "nosniff"; index index.html index.htm index.php; charset utf-8; location / { try_files $uri $uri/ /index.php?$query_string; } location = /favicon.ico { access_log off; log_not_found off; } location = /robots.txt { access_log off; log_not_found off; } error_page 404 /index.php; location ~ .php$ { fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; include fastcgi_params; } location ~ /.(?!well-known).* { deny all; } }