Home > database >  Can't access dockerized app url in selenium dockerized image
Can't access dockerized app url in selenium dockerized image

Time:05-28

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.

This is the error I'm receiving after adding webdriverwaits implicit waits

CodePudding user response:

You have three options:

  • You can access VueJS App on 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.
  • You can assign container name to VueJS container. and use http://{VueJS Container Name}:80 you can add container name in run with ththis param --name {Container-Name}
  • You can use Docker-Compose.

CodePudding user response:

run both Vue.js and Selenium containers with docker run --network=host

  • Related