I’ve dockerized vue.js app running on localhost:8090 on a VM server. I’ve connected that VM server to my VS Code using SSH and was able to access the vue.js app on my local machine’s chrome browser after port forwarding.
But in the same VM, there’s another selenium python dockerized project which does automated testing of the vue.js app so it needs to access the localhost:8090 URL. when the Vue.js app server is up. Unfortunately, the python selenium project isn’t able to get and request the localhost:8090 URL. I’ve increased sleep time in selenium tests and also added implicit or dynamic(webdriverwaits) but still won’t work.
It would be a +1 if someone can suggest how to open localhost:8090 in VM vscode without port forwarding.
2
Answers
run both Vue.js and Selenium containers with docker run –network=host
You have three options:
http://host.docker.internal:8090
from testing container.to access port from host machine. you need to use
host.docker.internal
as DNS route name.http://{VueJS Container Name}:80
you can add container name in run with ththis param
--name {Container-Name}