我有一个docker配置(php,mysql,nginx),我需要运行phinx。
问题是,当我运行vendor/bin/phinx migrate -e development
命令时,系统无法在Docker容器上工作,即使我将phinx.yml
配置为这样!
我有这个错误消息:
PDOException: PDO::__construct(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/html/.
/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/PdoAdapter.php:80
Stack trace:
#0 /var/www/html/ /vendor/robmorgan/phinx/src/Phinx/Db/Adapter/PdoAdapter.php(80): PDO->__construct()
这意味着phinx无法识别docker配置。
phinx.yml:
paths:
migrations: '%%PHINX_CONFIG_DIR%%/db/migrations'
seeds: '%%PHINX_CONFIG_DIR%%/db/seeds'
environments:
default_migration_table: phinxlog
default_environment: development
production:
adapter: mysql
host: service_mysql
name: mydb
user: root
pass: '123456'
port: 3306
charset: utf8
development:
adapter: mysql
host: service_mysql
name: my_database
user: root
pass: '123456'
port: 3306
charset: utf8
testing:
adapter: mysql
host: localhost
name: testing_db
user: root
pass: ''
port: 3306
charset: utf8
version_order: creation
我的问题是如何在docker中使用phinx?
2条答案
按热度按时间z31licg01#
我找到了答案,我应该在docker php容器中运行phinx命令:
tquggr8v2#
你的docker容器很可能不在同一个网络中。