2016-11-12 63 views
0

我試圖Mysql容器Piwik連接「PHP應用程序」杉杉我運行mysql的容器是這樣的:泊塢窗:失敗與MySQL數據庫連接

docker run --name piwik -e MYSQL_ROOT_PASSWORD=123456 -d mysql 

然後我試圖運行以及與此關聯的piwik應用命令:

docker run -d -e PIWIK_MYSQL_USER=root -e PIWIK_MYSQL_PASSWORD=123456 -e PIWIK_MYSQL_DBNAME=piwik -e PIWIK_MYSQL_PREFIX=piwik_ --link piwik:piwikmysql --name vpiwik marvambass/piwik 

然而,當我檢查日誌我看到這個錯誤:

ERROR 2005 (HY000): Unknown MySQL server host 'mysql' (0) 
>> no DB installed, MYSQL User or Password specified - seems like the first start 
> exec docker CMD 
nginx 
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) 
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use) 
2016/11/12 20:24:42 [emerg] 1#1: bind() to 0.0.0.0:80 failed (98: Address already in use) 
2016/11/12 20:24:42 [emerg] 1#1: bind() to 0.0.0.0:443 failed (98: Address already in use) 
[notice] 1#1: try again to bind() after 500ms 
[notice] 1#1: using the "epoll" event method 
[notice] 1#1: nginx/1.11.4 
[notice] 1#1: built by gcc 4.9.2 (Debian 4.9.2-10) 
[notice] 1#1: OS: Linux 4.4.14-moby 
[notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576 
[notice] 1#1: start worker processes 
[notice] 1#1: start worker process 141 

回答

0

mysql服務器(主機)名稱是不同的數據庫名稱。要解決您的問題,請更改爲,

--link piwik:mysql