我在本地计算机上创建了一个版本,并且运行良好。现在 试图在服务器中做同样的事情。它没有传递host-ip设置 Dockerfile但传递 172.17.0.3 并抛出以下错误
以下是错误:
Step 22/25 : RUN cd /usr/html/bin && ./magento setup:config:set --db-host=172.17.0.2 --db-name=mydb --db-user=tara --db-password=password
---> Running in 7bbe53f5d054
SQLSTATE[HY000] [1045] Access denied for user 'tara'@'172.17.0.3' (using password: YES)
[InvalidArgumentException]
Parameter validation failed
*主机IP来自另一个正在运行的容器的IP地址。这是172.17.0.2 *
为什么在连接期间输入错误的IP地址
HERE是dockerfile:
FROM docker-php:0.2
#mysqql setup
ENV DB_HOST 172.17.0.2
ENV DB_NAME mydb
ENV DB_USER admin
ENV DB_PASSWORD password
#magenot admin user
ENV ADMIN_USER tara
ENV ADMIN_PASSWORD password123
ENV ADMIN_FIRSTNAME tara
ENV ADMIN_LASTNAME gurung
ENV ADMIN_EMAIL tara.email@somelink.net
ADD ./magento2 /usr/html/
WORKDIR /usr/html/
RUN find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \;
RUN find var vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \;
RUN chown -R :docker .
RUN chmod u+x bin/magento
RUN composer install
CMD echo "Success installed Magento"
ENTRYPOINT ["/home/docker/run.sh"]
#get into the magento isntallation dir
#get into the magento isntallation dir
#start setting the necessasry file permission first
RUN cd /usr/html && \
chmod 777 generated -R && \
chmod 777 var -R
RUN cd /usr && \
chown -R docker:docker html
#start running the magento commands to install
RUN cd /usr/html/bin && \
./magento setup:config:set --db-host=$DB_HOST --db-name=mydb --db-user=bhavi --db-password=password
#installing the magento with admin user created
RUN cd /usr/html/bin && \
./magento setup:install --admin-user=$ADMIN_USER --admin-password=$ADMIN_PASSWORD --admin-firstname=$ADMIN_FIRSTNAME --admin-lastname=$ADMIN_LASTNAME --admin-email=ADMIN_EMAIL --use-rewrites=1
RUN chmod 777 vendor -R
RUN cd /usr && \
chown -R docker:docker html