Connecting kafDrop to a Secure Broker - docker

I am trying run kafDrop using docker image. I am able to connect to non SSL broker by running command
docker run -d --rm -p 9000:9000 --network=host -e KAFKA_BROKERCONNECT=KafkaServer:9092 obsidiandynamics/kafdrop
But when I tried to connect to same Broker with enabling SSL using command,
docker run -d --rm -p 9000:9000 --network=host -e KAFKA_BROKERCONNECT=KafkaServer:9092 -e KAFKA_PROPERTIES=$(cat kafka.properties | base64) -e KAFKA_TRUSTSTORE=$(cat myTrustStore | base64) -e KAFKA_KEYSTORE=$(cat myKeyStore | base64) obsidiandynamics/kafdrop
getting below error
/usr/bin/docker-current: Error parsing reference: "bmZpZy9wb21LZXlTdG9yZQpzc2wua2V5c3RvcmUucGFzc3dvcmQ9Y2hhbmdlaXQKc3NsLmtleS5w" is not a valid repository/tag: repository name must be lowercase.
and if I dont use base64 in command then I am getting error
/usr/bin/docker-current: Error parsing reference: "ssl.keystore.location=/opt/KafdropConfig/myKeyStore" is not a valid repository/tag: invalid reference format.
I have copied kafka.properties, myTrustStore and myKeyStore on the my machine where docker is running
Can you please help me to identify the mistake I am doing here?

not a valid repository/tag: repository name must be lowercase
This is a docker run error, which means your command was not escaped properly
Try adding quotes around the bash executions
docker run -d --rm -p 9000:9000 \
-e KAFKA_BROKERCONNECT=KafkaServer:9092 \
-e KAFKA_PROPERTIES="$(cat kafka.properties | base64)" \
-e KAFKA_TRUSTSTORE="$(cat myTrustStore | base64)" \
-e KAFKA_KEYSTORE="$(cat myKeyStore | base64)" \
obsidiandynamics/kafdrop
and you can use base64 or just volume mount the files.
https://github.com/obsidiandynamics/kafdrop#connecting-to-a-secure-broker
Note: I removed --network=host because if you really need that, then your Kafka networking needs adjusted to allow external clients

Related

How to have 2 containers connect to other container using TCP in docker network

I have this right now:
docker network rm cprev || echo;
docker network create cprev || echo;
docker run --rm -d -p '3046:3046' \
--net=cprev --name 'cprev-server' cprev-server
docker run --rm -d -p '3046:3046' \
-e cprev_user_uuid=111 --net=cprev --name 'cprev-agent-1' cprev-agent
docker run --rm -d -p '3046:3046' \
-e cprev_user_uuid=222 --net=cprev --name 'cprev-agent-2' cprev-agent
basically the 2 cprev-agents are supposed to connect to the cprev-server using TCP. The problem is I am getting this error:
docker: Error response from daemon: driver failed programming external
connectivity on endpoint cprev-agent-1
(6e65bccf74852f1208b32f627dd0c05b3b6f9e5e7f5611adfb04504ca85a2c11):
Bind for 0.0.0.0:3046 failed: port is already allocated.
I am sure it's a simple fix but frankly I don't know how to allow two way traffic from the two agent containers without using the same port etc.
So this worked (using --network=host) but I am wondering how I can create a custom network that doesn't interfere with the host network??
docker network create cprev; # unused now
docker run --rm -d -e cprev_host='0.0.0.0' \
--network=host --name 'cprev-server' "cprev-server:$curr_uuid"
docker run --rm -d -e cprev_host='0.0.0.0' \
-e cprev_user_uuid=111 --network=host --name 'cprev-agent-1' "cprev-agent:$curr_uuid"
docker run --rm -d -e cprev_host='0.0.0.0' \
-e cprev_user_uuid=222 --network=host --name 'cprev-agent-2' "cprev-agent:$curr_uuid"
so is there anyway to get this to work using my custom docker network "cprev"?

Problem trying to running Guacamole with Docker

I'm following this youtube tutorial. I have everything working fine until minute 8:00 when the video author copy and paste this command:
docker run --name guacamole --link guacd:guacd --link guac-mysql:mysql \ -e MYSQL_DATABASE='guacamole' \ -e MYSQL_USER='guacamole' \ -e MYSQL_PASSWORD='sqlpassword' \ -d -p 8080:8080 guacamole/guacamole
After it I'm having the annoying:
docker: invalid reference format.
see 'docker run --help'
I have tried other answers like this and this
Please, if someone knows how to overcome this problem give me help.
Thx!
Got it! Spacing was the problem.
I used
docker run --name guacamole^
--link guacd:guacd^
--link guac-mysql:mysql^
-e MYSQL_DATABASE='guacamole'^
-e MYSQL_USER='guacamole'^
-e MYSQL_PASSWORD='sqlpassword'^
-d -p 8080:8080 guacamole/guacamole
where (^) is my line breaker.

Db2 with Docker: How to resolve error from bash script?

I have a syntax problem - Mac Mojave- starting a docker bash script:
docker run -h db2server \
--name db2server_fp4 \
--restart=always p 50000:50000 \
--env-file ${HOME}/db2devc.env_list \
${HOME}/db2devc:/database \
store/ibmcorp/db2_developer_c:11.1.4.4-x86_64
gives this error:
JMB:~ Juergen$ ./db2docker2.sh
Unable to find image 'p:latest' locally
docker: Error response from daemon: pull access denied for p, repository does not exist or may require 'docker login'.
See 'docker run --help'.
./db2docker2.sh: line 6: /Users/Juergen/db2devc:/database: No such file or directory
There seems to be a mistake in your docker run command. There is missing hyphen before the p and docker recognizes it as the image name.
There also seems to be a missing -v before what looks like a volume mount.
Try with the following command:
docker run -h db2server \
--name db2server_fp4 \
--restart=always -p 50000:50000 \
--env-file ${HOME}/db2devc.env_list \
-v ${HOME}/db2devc:/database \
store/ibmcorp/db2_developer_c:11.1.4.4-x86_64

docker saucelabs : invalid reference format

I have gone through this article http://www.testautomationguru.com/selenium-webdriver-disposable-selenium-grid-infrastructure-setup-using-zalenium Integrating with Cloud Testing Platforms:
I have already added sauce username and access key in Environment variables. It docker, Zalenium works without Saucelabs but with saucelabs gives error: docker.exe: invalid reference format.
Without Saucelabs - works fine:
docker run --rm -ti --name zalenium -p 4444:4444
-v /var/run/docker.sock:/var/run/docker.sock
-v /tmp/videos:/home/seluser/videos --privileged dosel/zalenium start
With Saucelabs - gives formatting error:
docker run --rm -ti --name zalenium -p 4444:4444 -p 5555:5555 \
-e SAUCE_USERNAME
-e SAUCE_ACCESS_KEY \
-v /tmp/videos:/home/seluser/videos \
-v /var/run/docker.sock:/var/run/docker.sock \ dosel/zalenium start --sauceLabsEnabled true
I am using Docker Toolbox on Windows 7
Already took reference of:
docker: invalid reference format in shell script
docker : invalid reference format
Docker command returns "invalid reference format"
My mistake was - I was using back slash \. After removing it from command it worked. After removing it becomes
docker run --rm -ti --name zalenium -p 4444:4444 -p 5555:5555
-e SAUCE_USERNAME
-e SAUCE_ACCESS_KEY
-v /tmp/videos:/home/seluser/videos
-v /var/run/docker.sock:/var/run/docker.sock dosel/zalenium start --sauceLabsEnabled true
Take care of unnecessary space also.

Kafka FQDN in containers enviornment

Running kafka on a container and trying to create a new pgsql container on the same host.
the pgsql container keeps exiting and the logs indicates
ERROR: Failed to connect to Kafka at kafka.domain, check the docker run -e KAFKA_FQDN= value
the kafka container is built with the following attributes
docker run -d \
--name=app_kafka \
-e KAFKA_FQDN=localhost \
-v /var/app/kafka:/data/kafka \
-p 2181:2181 -p 9092:9092 \
app/kafka
the pgsql container with
docker run -d --name app_psql \
-h app-psql \
**-e KAFKA_FQDN=kafka.domain \
--add-host kafka.domain:172.17.0.1 \**
-e MEM=16 \
--shm-size=512m \
-v /var/app/config:/config \
-v /var/app/postgres/main:/data/main \
-v /var/app/postgres/ts:/data/ts \
-p 5432:5432 -p 9005:9005 -p 8080:8080 \
app/postgres
If i'm using docker0 ip address, the logs indicates no route to host, if i'm using the kafka docker ip, i'm getting connection refused.
I guess i'm missing something basic here that needs to be modified to my environment, but I'm lacking in knowledge here.
Will appreciate any assistance here.
You need edit container file hosts, you can pass a script in dockerFile like to
COPY dot.sh .
ENTRYPOINT ["sh","domain.sh"]
And domain.sh
#!/bin/sh
echo Environment container kafka is: "kafka.domain"
echo PGSQL container is "pgsql.domain"
echo "127.0.0.1 kafka.domain" >> /etc/hosts
echo "127.0.0.1 pgsql.domain" >> /etc/hosts
Feel free change ip or domain to needs.

Resources