gramex docker | running multiple instances within docker - docker

as per gramex-install-doc gramex could be started by running
# Run Gramex on port 9988
docker run --name gramex-instance -p 9988:9988 gramener/gramex
is it possible to start multiple gramex instances by changing --name parameter & different port numbers using -p parameter?
when I tried to start gramex by:
docker run --name gramex-test-port -p 9998:9998 gramener/gramex
in the console it was still printing:
INFO 13-Apr 18:21:41 __init__ PORT Listening on port 9988
can multiple gramex instances be started using gramex-docker-install?

adding you application's gramex.yaml with below entry:
app:
listen:
port: 9998
and then starting docker container at the application directory with below params is starting gramex at required port
docker run --name gramex-agri-prod -i -t -p 9998:9998 -v "$(pwd)":"$(pwd)" -w "$(pwd)" gramener/gramex
Note: include -d param to run it as deamon process

Related

Wiremock Docker Container not using the supplied port (instead using 8080)

I am using WireMock Docker image and spinning off the container using it. I can verify the container is up and running but after looking at container logs, looks like it is still running on 8080? At least, I am not able to access Wiremock using localhost:9999/__admin
Create Wiremock container: docker run -d -p 9999:9999 my-registry.com/rodolpheche/wiremock --verbose
Verify container: docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7b9847734cd4 my-registry.com/rodolpheche/wiremock "/docker-entrypoint.…" 7 seconds ago Up 5 seconds 8080/tcp, 8443/tcp, 0.0.0.0:9999->9999/tcp elegant_elion
You need to run docker run -it --rm -p 9999:8080 rodolpheche/wiremock in order to run the Wiremock as clearly mentioned in the documentation. It will be accessible using this url: http://localhost:9999/__admin
This fixed my issue (appending --port 9999):
docker run -d -p 9999:9999 my-registry.com/rodolpheche/wiremock --verbose --port 9999

Unable to connect with container at address /0.0.0.0:9000

My container of play/scala application starts at [info] p.c.s.AkkaHttpServer - Listening for HTTP on /0.0.0.0:9000. But I am unable to connect to it from the browser. I am running the container on my windows machine after having build the image using Docker for Windows
The Dockerfile is
FROM openjdk:8
WORKDIR deploy
COPY target/universal/myapp-1.0.zip .
COPY conf/logback_dev.xml ./logback.xml
COPY conf/application_dev.conf ./application.conf
RUN unzip myapp-1.0.zip
RUN chmod +x myapp-1.0/bin/myapp
EXPOSE 9000
ENTRYPOINT myapp-1.0/bin/myapp -Dplay.http.secret.key=changemeplease -Dlogger.file=/deploy/logback.xml -Dconfig.file=/deploy/application.conf
I am starting the container as docker run myApp -p 9000:9000 -network="host" and also tried docker run myApp -p 9000:9000 -network="host"
UPDATE
this is interesting.
If I specify image name before port then the application isn't reachable
docker run myApp -p 9000:9000
In docker container ps -a, I see (no mapping of localhost:9000 to 9000)
C:\Users\manuc>docker container ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4d16547cd96d myApp "/bin/sh -c 'myApp…" 10 seconds ago Up 9 seconds 9000/tcp, 9042/tcp ecstatic_bell
but if I specify port before image name, then the application is reachable
docker run -p 9000:9000 myApp
In docker container ps -a, I see mapping of localhost:9000 -> 9000
C:\Users\manuc>docker container ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
24b571cc0057 myApp "/bin/sh -c 'MyApp…" 39 seconds ago Up 38 seconds 0.0.0.0:9000->9000/tcp, 9042/tcp silly_yalow
Things to do when your container is not behaving like you want:
Check if your application is running in your computer.
After you run your container, check if it is healthy with docker ps. If it is not healthy, the problem is usually in your application.
Ensure it is running without errors, check logs with docker logs <container-id>. If logs are ok, problem is usually in the container network configuration.
Ensure you can access your application with docker exec -it <container-id> bash. And try to access port with curl or wget. If it is not reachable problem can be in iptables, firewall, or your application.
If you can ensure all the steps above working as expected. The problem is in docker network configuration.
Docker network host only works in linux, not mac and windows. You can run container with docker run -p 9000:9000 myapp. Checkout documentation: https://docs.docker.com/network/host/#:~:text=The%20host%20networking%20driver%20only,the%20docker%20service%20create%20command.
General form of the docker run command is docker run [OPTIONS] IMAGE[:TAG|#DIGEST] [COMMAND] [ARG...] as you can see in documentation. You need to specify port options before image name.

How to change airflow home from docker to local system

I have installed Airflow on docker. I want to know how to change Airflow home path from docker to my local system.
ex:
airflow home (now) : /usr/local/airflow
want to change to : mysystempath
docker run -d -p 8080:8080 -v /path/to/dags/on/your/local/machine/:/usr/local/airflow/dags puckel/docker-airflow webserver
tried above not working:
-- error message -- docker: Error response from daemon: driver failed programming external connectivity on endpoint gallant_pasteur (6f5e5a820b81847758c4e3e23a826b3bc5d4d7d67743cf55d6b01893cf427a1e): Bind for 0.0.0.0:8080 failed: port is already allocated.
It looks like you want to mount a local directory as dags folder for the airflow run within a local docker container.
Here's one example:
Given a local directory ~/Downloads/airflow_dags, you have a DAG named tutorial.py copied from here.
Then run an airflow container from image puckel/docker-airflow:latest:
docker run -d -p 8080 -v ~/Downloads/airflow_dags:/usr/local/airflow/dags --name airflow-webserver puckel/docker-airflow:latest webserver
Then you can run the following command to work with the DAG tutorial.py:
docker exec -it airflow-webserver airflow initdb
docker exec -it airflow-webserver airflow list_dags
docker exec -it airflow-webserver airflow list_tasks tutorial

TIBCO monitoring docker image

I read the blog: https://www.rubix.nl/blogs/tibco-monitoring-docker-how-create-instantiate-and-start-tibco-businessworks-container-edition
The blog entry is very interesting. Unfortunately, it does not work for me. My Tibco service does not connect to the monitoring.
Here is some data:
Bwce Version: 2.3
Bwce Mon Version: 2.4
Log entry from my Tibcoservice: Failed to register with Monitoring
application - response code [400] and Reason Phrase [Bad Request]
Log entry from my bwce-mon:
INFO:{"host":"172.17.0.4","port":"8090","instanceName":"6866a20e7bd6","appName":"6866a20e7bd6"
WARN : Container is not running for (host, port):(172.17.0.4, 8090). Please register running container
Docker run command for Tibcoservice: docker run -d -p 7575:7575 --link bwceadmin --name helloworld -e EMS_URL=tcp://ubdev-ws-003:7223 -e EMS_QUEUE=docker.queue -e BW_APP_MONITORING_CONFIG='{"url":"http://bwceadmin:8080"}'
helloworld:1.0.0
Docker run command for bwce-mon: docker run -p 8080:8080 -e persistence_DB="dockerpostgres" -e
DB_URL="postgres://postgres:#172.17.0.2:5432/postgres" -e
PERSISTENCE_TYPE=postgres --name bwceadmin bwcemon:2.4.0
Do you have any idea why this did not work for me?
I didn't write the blog post, but I think your issue might be in the configuration of the property "BW_APP_MONITORING_CONFIG".
Can you check if you can access the URL http://bwceadmin:8080? If you can't access that, the issue is most likely to do with the configuration of that property.
To find the setting for that URL, you'll need to know the IP address of the container running your app:
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <your container name>
After getting the IP address (like 10.100.22.1), you can start a new BWCE app and add a property for the monitoring URL:
BW_APP_MONITORING_CONFIG='{"url":"http://10.100.22.1:8080"}'

Docker zookeeper image unable to connect to sheepkiller/kafka-manager image

I am using two images sheepkiller/kafka-manager/ (Tool from Yahoo Inc) but the image was made by someone with a weird sense of humor but it has good reviews.
And zookeeper
I start ZooKeeper
docker run --it --restart always -d zookeeper
then try to start apache manager
docker run -it --rm -p 9000:9000 -e ZK_HOSTS="your-zk.domain:2181" -e APPLICATION_SECRET=letmein sheepkiller/kafka-manager
Document says:
(if you don't define ZK_HOSTS, default value has been set to "localhost:2181")
Error:
Initiating client connection, connectString=localhost:2181 sessionTimeout=60000 watcher=org.apache.curator.ConnectionState#7bf272d3
[info] o.a.z.ClientCnxn - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
[info] k.m.a.KafkaManagerActor - zk=localhost:2181
[info] k.m.a.KafkaManagerActor - baseZkPath=/kafka-manager
[warn] o.a.z.ClientCnxn - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
I am using Docker version 17.12.0-ce, build c97c6d6 on windows 10. I have tried several different things but was unsuccessful. I am assuming there is an issue with the ports, I zookeeper config file and /sheepkiller/kafka-manager/dockerfile/ but I am not sure how to change these images after I already pulled them if that really is the case.
The following should work fine:
docker network create zookeeper-net
docker run -it --restart always -p 2181:2181 --network zookeeper-net --name zookeeper -d zookeeper
docker run -it --rm -p 9000:9000 -e ZK_HOSTS="zookeeper:2181" -e APPLICATION_SECRET=letmein sheepkiller/kafka-manager
Update:
There is also a compose file to setup everything. I suggest you use that.
docker-compose up -d

Resources