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

"Bern": Docker web container can't connect to db container. fails to recognise working solution #62

Open
joshuamkite opened this issue Jan 15, 2025 · 0 comments

Comments

@joshuamkite
Copy link

docker network create wordpress_net
docker network connect wordpress_net wordpress
docker network connect wordpress_net mariadb
5d9697c2a030a4469c2dedbe8be0541d4022a6545c036fa42a335be319dc05bf
root@ip-172-31-19-232:~# docker exec wordpress mysqladmin -h mariadb -u root -ppassword ping
mysqld is alive
root@ip-172-31-19-232:~# exit
admin@ip-172-31-19-232:/$ cat ~/agent/check.sh
#!/usr/bin/bash
res=$(sudo docker exec wordpress mysqladmin -h mysql -u root -ppassword --connect-timeout 2 ping)
res=$(echo $res|tr -d '\r')

if [[ "$res" = "mysqld is alive" ]]
then
  echo -n "OK"
else
  echo -n "NO"
fi

admin@ip-172-31-19-232:/$ ~/agent/check.sh
mysqladmin: connect to server at 'mysql' failed
error: 'Unknown MySQL server host 'mysql' (-2)'
Check that mysqld is running on mysql and that the port is 3306.
You can check this by doing 'telnet mysql 3306'
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

1 participant