I have a run config1 like so
docker run
--name webapp_postgres
-e POSTGRES_PASSWORD='abc123'
-e POSTGRES_DB="webapp"
-p5432:5432
-d postgres
and config2 like so
docker run
--name webapp
-p8080:8443
appname/webapp
Is there a way to allow config2 to access config1 as localhost?
I’ve tried creating a custom docker network, and placing config1 and config2 in the network via the --net
flag, but that doesn’t seem to work.
I’ve also tried --net host
for config2 but that disallows publishing ports, so the container gets access to 5432 but then I cant access the container website.
Please note: I am not currently able to change the address the app looks for due to architectural issues, which will be handled later. In moving to docker, I need to have it look for localhost
and only localhost, atleast for right now.