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"]
Related
Yesterday i created a MariaDB image with this command:
docker run --name test_smdb -e MYSQL_ROOT_PASSWORD=<some_password> -p 3306:3306 -d mariadb:10.4.26
And as here is said:
https://docs.docker.com/config/containers/container-networking/
-p 8080:80 Map TCP port 80 in the container to port 8080 on the Docker host.
So i expected to be able to connect to the database via localhost:3306, from a Python application, running in another container in the same Docker instance (deployed on my machine), but this did not happen. I got:
Can't connect to MariaDB : 2003 (HY000): Can't connect to MySQL server on 'localhost:3306' (99)
So after some investigation and following some advices from here:
Docker cannot connect application to MySQL
, executing :
docker network list
docker network inspect <id>
i got the ip of the container and connected to MariaDB, using it.
But i still would like to connect to the MariaDB container, using localhost. How to do that?
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.
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
I'm trying to do an jenkins on docker, on my machine (Ubuntu).
I have to access to the git repo, in my company.
But in jenkins, I get this error :
Could not resolve host: gogs.mycompany.com
I think this is an DNS error, so I tried to launch my docker like that (with --dns and --dns-search)
sudo docker run -p 8080:8080 -p 50000:50000 -v
/home/xero/jenkins:/var/jenkins_home
--name=myproject-jenkins2 --dns=127.0.1.1 --dns-search=mycompany.lan jenkins
Here my /etc/resolv.conf :
nameserver 127.0.1.1
search mycompany.lan
What I'm doing wrong ?
The DNS was wrong. (--dns=127.0.1.1)
This DNS server, is an internal DNS, Dnsmasq, it's a DNS forwarder.
So I needed to know the real internal DNS server :
nmcli dev show | grep DNS
And add the right address (10.0.1.1 in my case) :
sudo docker run -p 8080:8080 -p 50000:50000 -v
/home/xero/jenkins:/var/jenkins_home --name=myproject-jenkins2
--dns=10.0.1.1 jenkins
I am running Docker container which runs a jar file inside it.
This jar file need an access to Elasticsearch for reading data and this Elasticsearch service is installed on the local machine (Not in Docker Container)
I need to connect to local Elasticsearch service from Docker container to make it work
I wrote EXPOSE 9200 9300 service-port in Dockerfile and my Docker run command is as follows,
"docker run -itd --memory=1g -p 9300:9300 -p 9200:9200 -p service-port:service-port --name service-name service-name -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:MaxRAMFraction=2 -XshowSettings:vm"
and when I run this command I get following error,
"docker: Error response from daemon: driver failed programming external connectivity on endpoint service-name (3de884dd9a62a4a989475721cc4cdf9cb6b78f1a8d345e590471d85052d6a4de): Error starting userland proxy: listen tcp 0.0.0.0:9300: bind: address already in use."
P.S = On my Local server I need to keep elasticsearch service ON
Both the EXPOSE line you quote and the docker run -p 9200:9200 -p 9300:9300 options tell Docker that you are running a container that is providing an Elasticsearch server, that you want to have listening for connections on those ports.
If you’re just trying to make an outbound connection to an Elasticsearch service running somewhere else, you don’t need these options and should remove them.