I know that Docker Compose (compose) is a tool that among other things makes setting up interconnectivity between containers much easier, but I am trying to practice doing that without compose to see what that process is like (and gain a deeper appreciation for compose in the long run).
Is the reason it is hard to run an app (in my case rails) + a sql server without compose because they are isolated units, so they don't know about each others file system and so don't know how to locate one another and that's why we use compose? Is there another reason?
How would you approach connecting the containers without using compose? If it's helpful I posted some metadata about the two containers below.
When run docker inspect on my postgres container I see an ENV and network config of:
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/postgresql/12/bin",
"PGDATA=/var/lib/postgresql/data"
]
"Networks": {
"bridge": {
"NetworkID": "e68fdafe2110067389853515b05b09cd0ce75c500190fae85abff82417794b7f",
"EndpointID": "0d5564c073286bf7c1d708d52146653cf75705f34c1e175963eba4c158424399",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.2",
"MacAddress": "02:42:ac:11:00:02",
}
}
And for the rails container:
"Env": [
"PATH=/usr/local/bundle/bin:/usr/local/bundle/gems/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
]
"Networks": {
"bridge": {
"NetworkID": "e68fdafe2110067389853515b05b09cd0ce75c500190fae85abff82417794b7f",
"EndpointID": "e76ad694f04b7ca07e388ab39ab81b00409500d4c175b5ce9f90a8c740da7246",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.3",
"MacAddress": "02:42:ac:11:00:03",
}
}