0.9.1 using external MariaDB/MySQL #76
-
Hi! I've configured baikal-docker and it starts up. Is there maybe a way to define the db within the docker-compose file? Thanks! Best regards |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Hmm, based on https://stackoverflow.com/a/48547074 that IP address should work, but double check with the following commands if the IP address is the correct one. The following assumes that you use the default bridge network mode (see "DRIVER" column): # Lists all networks, only the "bridge" ones are important
$ docker network ls
NETWORK ID NAME DRIVER SCOPE
71ea53e8e769 bridge bridge local
9fda14c20e2b baikal_default bridge local
268e9280dbb5 host host local
f348769d07z8 none null local If you use Docker Compose, then use the network with the folder name (or the name you gave it), otherwise use If the driver is not After that, you can verify which network the Baikal container uses with $ docker inspect <container name or id>
$ docker network inspect <network name or id, e.g. baikal_default>
# Note the "Gateway", that's the IP that you should use
# (...)
{
"Subnet": "172.18.0.0/16",
"Gateway": "172.18.0.1"
}
# (...) If there was just a small typo/wrong network and it now works, I'd recommend to use an alias instead of the hardcoded IP address. I had IP addresses change on me when recreating/restoring Docker networks, aliases make your life safer there. Easiest is adding If the IP address and port numbers are correct, then I don't have another idea as to why this wouldn't work other than local firewall rules. I then only see two workarounds to get it to work:
There's an example file for option two here: https://github.com/ckulka/baikal-docker/blob/master/examples/docker-compose.mariadb.yaml. It uses MariaDB, but you can change the image (https://hub.docker.com/_/mysql) and you should be good. |
Beta Was this translation helpful? Give feedback.
-
Hi! If I enter docker network inspect baikal_default That's not what I expected... I like not use a containered db. I whant to use the locally installed db on the server. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Hi! I added "network_mode: bridge" to the compose file and now I can reach the MariaDB! |
Beta Was this translation helpful? Give feedback.
Hmm, based on https://stackoverflow.com/a/48547074 that IP address should work, but double check with the following commands if the IP address is the correct one. The following assumes that you use the default bridge network mode (see "DRIVER" column):
If you use Docker Compose, then use the network with the folder name (or the name you gave it), otherwise use
bridge
.