美文网首页
docker-composean安装mysql+phpmyadm

docker-composean安装mysql+phpmyadm

作者: 程序员大春 | 来源:发表于2022-06-27 18:48 被阅读0次

安装docker-composean

sudo curl -L https://get.daocloud.io/docker/compose/releases/download/1.25.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
mkdir /docker/
cd /docker
vim docker-compose.yml

编辑 vim docker-compose.yml

version: "3.5"

services:
  db:
    image: mariadb
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    ports:
      - 3306:3306
    volumes:
      - "./db:/var/lib/mysql"        #左边 ./db 代表数据库持久化目录位置
    environment:
      - "TZ=Asia/Shanghai"
      - "MYSQL_ROOT_PASSWORD"
      - "MYSQL_DATABASE"
      - "MYSQL_USER"
      - "MYSQL_PASSWORD"
    restart: always

  traefik:
    image: traefik:v1.7.16
    ports:
      - 80:80
      - 443:443
    volumes:
      - "./traefik.toml:/etc/traefik/traefik.toml"
      - "./acme:/etc/traefik/acme"
    restart: always

  redis:
    image: redis:alpine
    environment:
      - "TZ=Asia/Shanghai"
    restart: always
    ports:
      - 6379:6379
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    environment:
      - "TZ=Asia/Shanghai"
    restart: always
    environment:
     - "MYSQL_ROOT_PASSWORD=ab123123"
     - "PMA_HOST=db"
     - "PMA_PORT=3306"
    links:
      - db
    ports:
      - 8081:80

执行

docker-compose up -d

相关文章

网友评论

      本文标题:docker-composean安装mysql+phpmyadm

      本文链接:https://www.haomeiwen.com/subject/zkrovrtx.html