DockerでphpMyAdminを起動してみる


AWS Workspaces
Amazon Linux2

docker-compose.yml
version: '3.7'

services:
  mariadb:
    container_name: mariadb
    hostname: mariadb
    image: mariadb:10.4.10
    volumes:
      - ./mariadb/data:/var/lib/mysql
    env_file:
      - ./.mariadb.env
  phpmyadmin:
    container_name: phpmyadmin
    hostname: phpmyadmin
    image: phpmyadmin/phpmyadmin:5
    env_file:
      - ./.phpadmin.env
    depends_on:
      - mariadb
    ports:
      - 4040:80
    volumes:
      - ./phpmyadmin/sessions:/sessions
mariadb.env
MYSQL_ROOT_PASSWORD=root
MYSQL_DATABASE=test
MYSQL_USER=test
MYSQL_PASSWORD=test
phpmyadmin.env
PMA_ARBITRARY=1
PMA_HOST=mariadb
PMA_USER=test
PMA_PASSWORD=test
mkdir -p mariadb/data
chmod 777 mariadb/data
mkdir -p phpmyadmin/sessions
chmod 777 phpmyadmin/sessions

docker-compose up -d