尝试使用docker phpmyadmin连接几个不同的mysql本地(容器)和远程服务器。一切正常,直到我开始登录 - 连接到远程服务器的工作就像一个魅力,问题是连接本地服务器的容器。 我的撰写内容看起来像这样:
version: '3'
services:
phpmyadmin:
image: phpmyadmin_4.7.6
container_name: phpmyadmin
restart: always
ports:
- "8081:80"
volumes:
- "./conf_phpmyadmin/:/root/confs/"
- "/sessions"
networks:
proxy:
ipv4_address: "172.18.0.4"
environment:
- PMA_ABSOLUTE_URI=https://<access-url>/phpmyadmin/
- PMA_HOSTS=172.21.0.3,192.168.1.65
- PMA_VERBOSES=LocalMysqlContainer,RemoteMySql
links:
- mysql-5.7:mysql
php7:
restart: always
image: php7-phalcon
hostname: <hostname>
container_name: <container name>
expose:
- 82
# add static IP in case of restart
networks:
network1:
ipv4_address: "172.21.0.2"
proxy:
environment:
- VIRTUAL_HOST=${VIRTUAL_HOST}
- LETSENCRYPT_HOST=${VIRTUAL_HOST}
- LETSENCRYPT_EMAIL=${EMAIL}
mysql-5.7:
restart: always
image: prod-mysql
container_name: mysql
# add static IP in case of restart
networks:
network1:
ipv4_address: "172.21.0.3"
volumes:
- "/var/lib/mysql"
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASS}
# create custom network
networks:
proxy:
external:
name: webproxy_proxy
network1:
driver: bridge
ipam:
config:
- subnet: "172.21.0.0/24"
使用:
docker-compose version 1.17.1, build 6d101fb
docker-py version: 2.5.1
CPython version: 2.7.13
OpenSSL version: OpenSSL 1.0.1t 3 May 2016
Docker本身:
Client:
Version: 17.09.0-ce
API version: 1.32
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:42:18 2017
OS/Arch: linux/amd64
Server:
Version: 17.09.0-ce
API version: 1.32 (minimum version 1.12)
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:40:56 2017
OS/Arch: linux/amd64
Experimental: false
答案 0 :(得分:0)
Okei,自己想通了。 找到解决方案的帮助:https://www.dgendill.com/posts/programming/2016-07-03-docker-mysql-notes.html 但不确定,究竟有什么帮助,但是......