Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FQA 中 Docker内部的MySQL、Redis无法连接问题 描述有问题 #41

Closed
coolfish-a opened this issue Dec 12, 2019 · 3 comments
Closed

Comments

@coolfish-a
Copy link

image
这个 /var/www/codo-admin/db_sync.py 是容器内部文件,你截图描述为 从宿主机上查看,而且从宿主机 ping容器ip 也不会ping通

另:
搭建时,在此出错
[root@localhost codo-cmdb]# docker exec -ti codocmdb_codo_cmdb_1 /usr/local/bin/python3 /var/www/codo-cmdb/db_sync.py
File "/usr/local/lib/python3.6/socket.py", line 713, in create_connection
sock.connect(sa)
TimeoutError: [Errno 110] Connection timed out
raise exc
pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on '172.16.0.223' ([Errno 110] Connection timed out)")
我通过清理iptables -F 后,此问题仍然存在,请问如何解决?

@ss1917
Copy link
Contributor

ss1917 commented Dec 12, 2019

172.16.0.223 这是谁的地址??? 你不检查下配置吗

@coolfish-a
Copy link
Author

coolfish-a commented Dec 12, 2019

172.16.0.223 这是谁的地址??? 你不检查下配置吗
谢谢提醒,这一步是在mysql数据库中创建表,数据库已经创建成功,我进入mysql容器查看ip并不是这个地址172.16.0.223,mysql容器地址查看:/etc/hosts 是172.17.0.5 请问该如何排查这种问题?

@coolfish-a
Copy link
Author

#41 (comment) 查到问题原因了,是我修改脚本未正常执行,谢谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants