0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

なんかうまくいかないことが多かったのでメモ

起動させてから3分くらいは待った方がいい
phpmyadminで一生接続できないエラーがでる。

version: '3.8'

services:
  # PHP 8.3.8 with Apache (モジュールモード)
  php-apache:
    image: php:8.3.8-apache
    container_name: php_server
    ports:
      - "8014:80"
    volumes:
      - ./src:/var/www/html
      - ./php/php.ini:/usr/local/etc/php/php.ini
    environment:
      - APACHE_DOCUMENT_ROOT=/var/www/html
    depends_on:
      - mysql
    networks:
      - app-network
    command: >
      bash -c "
      docker-php-ext-install mysqli pdo pdo_mysql &&
      a2enmod rewrite &&
      apache2-foreground
      "

  # MySQL 8.0
  mysql:
    image: mysql:8.0
    container_name: mysql_server
    ports:
      - "3308:3306"
    environment:
      MYSQL_ROOT_PASSWORD: rootpassword
      MYSQL_DATABASE: testdb
      MYSQL_USER: testuser
      MYSQL_PASSWORD: testpassword
    volumes:
      - mysql_data:/var/lib/mysql
      - ./mysql/my.cnf:/etc/mysql/conf.d/my.cnf
    networks:
      - app-network
    command: >
      --default-authentication-plugin=mysql_native_password
      --character-set-server=utf8mb4
      --collation-server=utf8mb4_unicode_ci
    restart: unless-stopped

  # phpMyAdmin
  phpmyadmin:
    image: phpmyadmin/phpmyadmin:latest
    container_name: phpmyadmin_server
    ports:
      - "8015:80"
    environment:
      PMA_HOST: mysql
      PMA_PORT: 3306
      PMA_USER: root
      PMA_PASSWORD: rootpassword
      MYSQL_ROOT_PASSWORD: rootpassword
      PMA_ARBITRARY: 1
      PMA_ABSOLUTE_URI: http://localhost:8015/
    depends_on:
      - mysql
    networks:
      - app-network
    restart: unless-stopped

volumes:
  mysql_data:

networks:
  app-network:
    driver: bridge
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?