docker-compose搭建phpmyadmin
yin5th@yin5th:~/code/docker/phpmyadmin$ tree . └── docker-compose.yml 0 directories, 1 file
文件结构: 只有一个docker-compose.yml
docker-compose.yml:
yin5th@yin5th:~/code/docker/phpmyadmin$ cat docker-compose.yml version: '3' services: phpmyadmin: image: "phpmyadmin/phpmyadmin" container_name: "phpmyadmin" ports: - "9090:80" environment: - PMA_ARBITRARY=1 db: image: "mysql:5.7" container_name: "phpmyadmin_db"
docker-compose.yml同级目录下执行:docker-compose up -d
访问localhost:9090即可
注:
1.如果只是用于本地连接,可以不设置:PMA_ARBITRARY=1
2.没有做数据库内容的保存,需要的话添加:volumes相关
3.修改了yml文件后,执行docker-compose down 然后 docker-compose up -d即可