On circleci, when I declare multiple dockers for a job:
dockers:
app: company/image
selenium: selenium/image
app will expose a port 4000 and selenium will expose port 4444.
Then from app container, I can access selenium service via localhost:4444, and on selenium container, I can access app webserver via localhost:4000.
docker-compose, however, behaves differently. I only allow me to access to selenium:4444 from app, and app:4000 from selenium.
I want docker-compose to behave similar to circleci, in which it allows me to use localhost:port to access other services. How can I do that?
The way to achieve the above is via networking_mode:
I need to tell docker-compose to run selenium using networking_mode = "services:app" so that every ports listened by selenium will be available to access from app using just localhost:PORT (and vice versa)
This is explained here: Can docker-compose share an ip between services with discrete ports?
Also the reason for it to work is explained in the docker networking model here: https://codability.in/docker-networking-explained/
Related
I'm currently trying to setup a nuxt server on Jelastic Cloud but I did not manage to make it available.
I configured auto deploy with git, with a post-deploy hook that builds the nuxt application. When the container is launched, I can see that nuxt is listening in the logs but when I go to check in the browser if it works, I get the 502 application down page.
I tried to apply variables such as JELASTIC_EXPOSE or JELASTIC_PRIORITY_PORTS to configure the shared load balancer but none of this is working. Even with a public IP address and refering to the right port in the URL, I couldn't access the app. I also saw that it's probably possible to use pm2 to launch the app but I want to avoid custom nginx configuration for this app, since I think it could work without.
Have you ever tried to do something like this ? Have you an idea of what I should do to make this work ?
Thanks a lot !
I found the solution !
Nuxt was listening on the host localhost and the automatic port forwarding done by jelastic shared load balancer doesn't work with that.
I changed the host to 0.0.0.0 and it works perfectly fine :)
In the logs I can now see that nuxt is listening on the private IP of the container instead of just localhost.
I'm trying to set up a testing CI with Github Actions and Docker Compose. You can see the repository here.
I have a frontend on port 3000 which communicates with a backend on port 4000. I am using a testing library (Cypress) that launches predetermined tasks in an emulated browser against the frontend.
My docker setup works locally, however I can't seem to get the networking / port mapping working correctly in the Github runner. The frontend service can't be found on http://localhost:3000.
NOTE: I am using network_mode: host to simplify the environment.
How can I configure the Github workflow to successfully connect to the frontend application on the host network on port 3000?
I've just finished setting up a Free Tier Cluster on MongoDB Atlas and wanted to play with MongoDB Charts so I followed the official installation guide.
It all went well (with a few glitches) but now I don't know where do I go to access the Charts Dashboard. It doesn't say anywhere. Any help?
Thanks!
MongoDB Charts beta runs as a web server in a Docker container, and it is exposed over port 80 on the host.
If you are logged into the host running the container you can simply go to http://localhost in a web browser.
If you are logged into a different machine, you can use the host's name or IP address. E.g. if the server is called "chartsserver" you would access it via http://chartsserver.
I'm trying to deploy my camel app which on start is creating a cxfrs endpoint. The url is like this: http://localhost:9876 . When I try to hit this one on a rest client or anywhere within my machine it works. But when I try to access it using my phone or other external devices, I'm not able to connect.
Am I missing something?
TIA
Using localhost will mean it is only accessible to your local machine, using 0.0.0.0 instead should make it publicly accessible.
0.0.0.0 should bind all available network interface on your remote machine, but from your description, somehow it only bind to localhost|127.0.0.1 so only accessible from local machine, could you use
http://external.ip.address:9876/foo/FooService
instead to see if it helps?
Also, you can try to access other network service(for example start a tomcat on remote machine and see if you can access it from your local machine) from that remote machine to see if it works, this can determine if your DNS correct or if there's really no firewall between them.
I created a test JBOSS web service and there is only one test method in it. I access this using http://localhost:8070/MyWebService/MyRESTApplication
and it shows the result from the web service. I tried this in both Eclipse and Browser and it works.
But when i want to access this web service using IP address of my system then it shows ERROR message that Page cannot be displayed (in fact browser is not able to find this web service).
I want to access like this http://IPaddress:8070/MyWebService/MyRESTApplication
what should i do so that i can access it using my IP from some computer
You have to start JBoss using :
./run.sh -b [your_IPaddress]
On windows:
start run.bat -b 0.0.0.0
This will tell it to start and bind to all network interfaces. You can also replace 0.0.0.0 with your actual IP if you only want it to bind to that network interface.
I find it easier for debugging to have it come up on all network interfaces because this will work when you are running a virtual machine to debug something like Internet Explorer.
Open your server setting in Eclipse and set Host name as your IP address or 0.0.0.0