I have created a Docker container using the following command:
docker run --network host --name mariadb -e MYSQL_ROOT_PASSWORD=testpass -d mariadb:latest
I'm trying to connect to the MariaDB Docker container in my IntelliJ project and getting the following error:
The specified database user/password combination is rejected:
[28000][1045] Access denied for user 'root'#'127.0.0.1' (using password: YES)
When I run without --network host and use container's IP 172.18.0.2, I get the following error:
[08][-1] Could not connect to address=(host=172.18.0.2)(port=3306)(type=master) : connect timed out
java.net.SocketTimeoutException: connect timed out.
I even tried updating bind-address in my.cnf file in the container but no success.
Please help me.
Maybe this can help you out sir?
https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000021659-The-specified-database-user-password-combination-is-rejected
Related
I installed Elasticsearch and Kibana on docker. I need to add Filebeat to the workflow, so I followed the official documentation Run filebeat setup
I run this command:
docker run docker.elastic.co/beats/filebeat:8.1.2 setup -E setup.kibana.host=localhost:5601 -E output.elasticsearch.hosts=["https://127.0.0.1:9200/"]
But I got this error :
Exiting: couldn't connect to any of the configured Elasticsearch
hosts. Errors: [error connecting to Elasticsearch at
https://127.0.0.1:9200/: Get "https://127.0.0.1:9200/": dial tcp
127.0.0.1:9200: connect: connection refused]
I'm working with the current version of ELK.
I resolved this problem, first I checked elasticsearch.yml and kibana.yml, I notice that the host address are not localhost,I also inspected both of the containers "KIBANA and ELASTIC" detail's and I found that they are pointing to the same host as yml file.
So run the command with the host adresses from the containers detail's and it worked :
docker run --net elastic -it docker.elastic.co/beats/filebeat:8.1.2 setup -E setup.kibana.host=172.18.0.3:5601 -E output.elasticsearch.hosts=["172.18.0.2:9200"]
im learning docker and go now
but i got the problem when i docker run with this
docker run --rm -p 8080:8080/tcp --env-file .env my-project:latest
here are some of my .env code. i use docker desktop on windows, is it not possible to run docker on localhost in windows?
DB_HOST=127.0.0.1
DB_USERNAME=root
DB_NAME=mydbs
DB_PASS=root123
AUTH_GEN_URL=https://api.learning.mydbs.id
anyone have a clue? any answer would be appreciated
thank youu
The problem is that when you spin up the container it tries to connect to 127.0.0.1:3306 within the container and not the host, hence you are getting the error as connection refused since nothing is running on port 3306 at localhost in your container.
For Windows and Mac this can easily be fixed by using host.docker.internal instead of 127.0.0.1. This ensures that the service running inside your container correctly connects to the MySQL instance running on the host machine.
For Linux it's even more simple as all you have to do is pass --network="host" option to the docker run command
I'm running locally a gremlin-client container and a gremlin-server container in 2 separate containers. I'm starting the following like so:
docker network create -o com.docker.network.bridge.enable_icc=true hacker
docker run --network hacker -p 8182:8182 tinkerpop/gremlin-server:3.4
docker run --network hacker -it tinkerpop/gremlin-console
When I try and connect to the remote server from the client like so:
:remote connect tinkerpop.server conf/remote.yaml
I get the following error:
Caused by: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: localhost/127.0.0.1:8182
Why is this? I tried to share the network, but still doesn't work. Any ideas? The port is forwarded and matching what is in the remote.yaml file.
Edit
I got it working by modifying the host in the conf file on the client to read as host.docker.internal
I got it working by modifying the host in the conf file on the client to read as host.docker.internal
My GCP ES service is port forwarded to localhost:9200 of my machine. I am able to log ingest from the local machine.
I have created JAVA script to do the same task and It is also running fine when I am running local
Now, I have created docker Image of that Java project using dockerFile and when I am creating a container, then I am getting the following error
Connect to localhost:9200 [localhost/127.0.0.1] failed: Connection refused (Connection refused)
Docker command :
docker run -it --net="host" gcplogingest:latest mvn -f BEATLe/pom.xml test -Dcomponent=detect -DtestSuite=CommonXML/Detect_loginjectionGCP
Note :
I have tried using --network="host" but I am still getting the same error.
Please suggest.
Have you tried removing --net=host and then use in your docker host.docker.internal instead 127.0.0.1?
Consider that your host localhost should be different than your docker localhost, and once you get that removing network=host, you need to access from docker to
host.docker.internal:9200
I have a java application and it can successfully connect to api.meraki.com in my local machine but when I deploy my java application to the test server,
the application which lives in a docker container can not connect to api.meraki.com.
In the host machine, I can also curl the api.meraki.com but inside my docker container (docker exec -it xxx /bin/bash), I can't curl as it gives a connection refused error.
I tried to use a new API key to test server but it is still giving connection refused error. I also tried to allow my test server from Meraki dashboard but no success.
Any ideas that what is the problem and the solution?
edit: i run container with
docker run -dit -p 9078:8080 -e "SPRING_PROFILES_ACTIVE=prod,swagger,preprod" --name abc -v /etc/localtime:/etc/localtime:ro -v /etc/hosts:/tmp/hosts example.com.com:5000/abc:v1.12.5
and in my container when i run getent hosts api.meraki.com resolves dns as:
209.206.57.71 mun211.meraki.com api.meraki.com emea.api.meraki.com n23.meraki.com
test server was behind proxy and it was not configured, configuring both container and the application resolved the problem. (i think the application is connecting other service by bypassing the proxy.