host.docker.internal is failed to connect in Oracle VM - docker

I have application installed in VM (centOS7) running on Oracle Virtual box with "Bridge Network" while communicating internal containers using : http://host.docker.internal:6001(other container port) it is throwing error saying #
request to http://host.docker.internal failed, reason: ETIMEDOUT 172.17.0.1:6001"
where as the same application while running in local I am able to connect to : http://host.docker.internal.
please help
my docker compose file
services:
configuration-service:
image: configuration-service:latest
restart: always
env_file: configuration-service.env
extra_hosts:
- "host.docker.internal:host-gateway"
dose-sheet-anonymizer-rs:
image: anonymizer-rs:latest
restart: always
ports:
- "6001:6001"
extra_hosts:
- "host.docker.internal:host-gateway"
env file:
anoymizer-host=http://host.docker.internal:6001

Related

The Docker container cannot access other services on the intranet of the host company

version: "3.7"
services:
tomcat:
image: tomcat:9
container_name: tomcat-change
ports:
- "18080:8080"
volumes:
- "./my.war:/usr/local/tomcat/webapps/my.war"
entrypoint:
- "catalina.sh"
- "run"
networks:
- mywork
networks:
mywork:
name: mywork
driver: bridge
ipam:
driver: default
config:
- subnet: 172.31.0.0/24
gateway: 172.31.0.1
this is my docker-compose.yml
The company's LAN IP address is 172.17.xxx.xxx
My local area network IP address is 172.17.6.xxx
There is an ordinary db server in the LAN 172.17.1.xxx
I run docker compose locally The yml Docker intranet cannot connect to the database of 172.17.1.xxx
com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host 172.17.1.xxx, port 1433 has failed. Error: "Connect timed out. Verify the connection properties. Make sure that an instance of SQL Ser
ver is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall
It is normal to start locally without using Docker
I use the window Docker Desktop
Docker version 20.10.11, build dea9396
ersion: "3.7"
services:
tomcat:
image: tomcat:9
container_name: tomcat-change
ports:
- "18080:8080"
volumes:
- "./my.war:/usr/local/tomcat/webapps/my.war"
entrypoint:
- "catalina.sh"
- "run"
extra_hosts:
- "db:172.17.1.xx"
This is all you need in the docker-compose.yml. Replace 172.17.1.xx with the ip of your database server. In your application refer to the database host by db.

Docker & Hive - Port 50070 ports on Windows permission denied

I want to setup a local hive server and found this repo:
https://github.com/big-data-europe/docker-hive
This is the yaml file I use.
version: "3"
services:
namenode:
image: bde2020/hadoop-namenode:2.0.0-hadoop2.7.4-java8
volumes:
- namenode:/hadoop/dfs/name
environment:
- CLUSTER_NAME=test
env_file:
- ./hadoop-hive.env
ports:
- "50070:50070"
datanode:
image: bde2020/hadoop-datanode:2.0.0-hadoop2.7.4-java8
volumes:
- datanode:/hadoop/dfs/data
env_file:
- ./hadoop-hive.env
environment:
SERVICE_PRECONDITION: "namenode:50070"
ports:
- "50075:50075"
hive-server:
image: bde2020/hive:2.3.2-postgresql-metastore
env_file:
- ./hadoop-hive.env
environment:
HIVE_CORE_CONF_javax_jdo_option_ConnectionURL: "jdbc:postgresql://hive-metastore/metastore"
SERVICE_PRECONDITION: "hive-metastore:9083"
ports:
- "10000:10000"
hive-metastore:
image: bde2020/hive:2.3.2-postgresql-metastore
env_file:
- ./hadoop-hive.env
command: /opt/hive/bin/hive --service metastore
environment:
SERVICE_PRECONDITION: "namenode:50070 datanode:50075 hive-metastore-postgresql:5432"
ports:
- "9083:9083"
hive-metastore-postgresql:
image: bde2020/hive-metastore-postgresql:2.3.0
presto-coordinator:
image: shawnzhu/prestodb:0.181
ports:
- "8080:8080"
volumes:
namenode:
datanode:
Error:
Error starting userland proxy: Bind for 0.0.0.0:50075: unexpected error Permission denied
The ports >50000 are blocked on windows, I donĀ“t have admin rights on my company pc, so I tried to map the ports like this:
ports:
- "40070:50070"
environment:
SERVICE_PRECONDITION: "namenode:40070 datanode:40075 hive-metastore-postgresql:5432"
This will let me get the Container started, but the container seem not to be able to communicate.
hive-metastore_1 | [1/100] check for namenode:40070...
hive-metastore_1 | [1/100] namenode:40070 is not available yet
hive-metastore_1 | [1/100] try in 5s once again ...
956a5237dbe2_docker-hive_datanode_1 | [4/100] check for namenode:40070...
956a5237dbe2_docker-hive_datanode_1 | [4/100] namenode:40070 is not available yet
I tried to change both ports:
ports:
- "40070:40070"
This will not work, because some IPs seem to be hardcoded:
ded7410db1b9_docker-hive_namenode_1 | 21/10/08 12:39:05 INFO hdfs.DFSUtil: Starting Web-server for hdfs at: http://0.0.0.0:50070
ded7410db1b9_docker-hive_namenode_1 | 21/10/08 12:39:05 INFO http.HttpServer2: Jetty bound to port 50070
Does anyone know how to get this running?
With the following:
ports:
- "40070:50070"
all you are doing is directing traffic from host port 40070 to container port 50070.
So to access "namenode" from the host machine for example:
localhost:40070
And to access "namenode" inside the compose network:
namenode:50070
Service precondition with BDE checks the container and the port repeatedly to see if the service is running before setting up its own services to ensure things are ready first. You have not changed the port running on the container, so your containers should still communicate via port 50070.
You have incorrectly changed the precondition to scan instead for your host port 40070, whereas it should look for the internal network container port 50070 regardless of host port.
Change it to the following:
ports:
- "40070:50070"
environment:
SERVICE_PRECONDITION: "namenode:50070 datanode:50075 hive-metastore-postgresql:5432"
You can change the operating ports on Hive etc. with the environmental variable file provided, but you shouldn't need to. Exposing host port 40070 to container port 50070 has no impact on the operation of the docker services.

using docker compose to run selenium hub and node

I have this docker-compose.yml file from here that I am using to open selenium hub and node on mac OS . I changed host port to 65299 , as I got error that 4444 is being used. I have docker desktop 3.5.1 installed
version: "3"
services:
selenium-hub:
image: selenium/hub
container_name: selenium-hub
ports:
- "65299:4444"
chrome:
image: selenium/node-chrome
depends_on:
- selenium-hub
environment:
- HUB_HOST=selenium-hub
- HUB_PORT=65299
firefox:
image: selenium/node-firefox
depends_on:
- selenium-hub
environment:
- HUB_HOST=selenium-hub
- HUB_PORT=65299
When I look here - http://localhost:65299/grid/console , I dont see any node registered
Also, on terminal I get this
firefox_1 | 20:27:22.110 INFO [SelfRegisteringRemote$1.run] - Couldn't register this node: The hub is down or not responding: Failed to connect to selenium-hub/172.26.0.2:65299
Also , in logs it says
Nodes should register to http://172.27.0.2:4444/grid/register/
so why is system even trying 172.26.0.2:65299 or may be I am missing something here ?
The HUB_PORT variable of nodes are wrong. 65299 port is the port for accessing hub from outside of docker network. For example you are using this port the access hub from browser.
You need to set 4444 to that variable. That port available to docker network. So nodes can connect hub.

Exposing docker to internet "Failed to complete tunnel connection"

I'm using this https://github.com/wernight/docker-ngrok , so that my dockerize app will expose to internet. I added it to my docker-compose, but when I up my container I get this error "Failed to complete tunnel connection". when I want to access my app I do it like this myapp.local and it works find because I set up windows host. when I access like this http://localhost I see this , I noticed I cannot access using localhost that's why I used windows host.
Here is my docker-compose
web:
image: nginx:stable
container_name: webcontainer
ports:
- "80:80"
volumes:
- ./:/var/www/myapp
- ./myapp.conf:/etc/nginx/conf.d/myapp.conf
expose:
- 9000
external_links:
- php
- db
ngrok:
image: wernight/ngrok
links:
- web
ports:
- "4040:4040"

Mapping ports in docker-compose file doesn't work. Network unreachable

I'm trying to map a port from my container, to a port on the host following the docs but it doesn't appear to be working.
After I run docker-compose -f development.yml up --force-recreate I get no errors. But if I try to reach the frontend service using localhost:8081 the network is unreachable.
I used docker inspect to view the IP and tried to ping that and still nothing.
Here is the docker-compose file I am using. And I doing anything wrong?
development.yml
version: '3'
services:
frontend:
image: nginx:latest
ports:
- "8081:80"
volumes:
- ./frontend/public:/var/www/html
api:
image: richarvey/nginx-php-fpm:latest
ports:
- "8080:80"
restart: always
volumes:
- ./api:/var/www/html
environment:
APPLICATION_ENV: development
ERRORS: 1
REMOVE_FILES: 0
links:
- db
- mq
db:
image: mariadb
restart: always
volumes:
- ./data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: dEvE10pMeNtMoDeBr0
mq:
image: rabbitmq:latest
restart: always
environment:
RABBITMQ_DEFAULT_USER: developer
RABBITMQ_DEFAULT_PASS: dEvE10pMeNtMoDeBr0
You are using docker toolbox. Docker toolbox uses docker machine. In Windows with docker toolbox, you are running under a virtualbox with its own IP, so localhost is not where your containers live. You will need to go 192.168.99.100:8081 to find your frontend.
As per the documentation on docker machine(https://docs.docker.com/machine/get-started/#run-containers-and-experiment-with-machine-commands):
$ docker-machine ip default
192.168.99.100

Resources