How to integrate Elassandra in my Jhipster app by Docker Image? - docker

I want to integrate elassandra in my jhipster app. In which i'm using cassandra as db.
i'm following the official elassandra installation process with docker image but their is confusion to understand which container_name have to add in which command.
here is official link: http://doc.elassandra.io/en/latest/installation.html#docker-image
and my port 9200 is not enabled
docker run --name some-elassandra -d strapdata/elassandra
docker run --name some-app --link some-elassandra:elassandra -d app-that-uses-elassandra

Elasticsearch ports 9200 and 9300 are exposed for communication between containers.
So when an elassandra container has been started like this :
docker run --name some-elassandra -d strapdata/elassandra
Contacting the REST API could be done with something like :
docker run -it --link some-elassandra --rm strapdata/elassandra curl some-elassandra:9200
If it still not working, be sure you pulled a recent version of the image, and feel free to open an issue on the github repository strapdata/docker-elassandra
This elassandra image is based on the official cassandra image. You may refer to its documentation for advanced setup.

Related

Docker container for portainer not exposing 9000 to host

I am trying to create the container by running docker run -d -p 8000:8000 -p 9000:9000 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:2.9.3
The container created but I am not able to access the portainer ui page using the localhost:9000enter image description here
As you can see the container is restarting. When every thing is fine the status will be running instead of restarting. It's possible that port is busy so it cant be exposed so you should check your port first and if the port was available you should check your image then to check if your image is working properly. It's better to use a docker file to make sure that your configuration is correct.

cannot access to docker container web app by using IP

I'm using Linux containers on Windows and containerize a simple web app to test.
Firstly I create a network with:
docker network create --subnet 192.168.15.0/24 new_network
Afterthat I run
docker container run -d --name web1 --publish 8080:8080 --network new_network test:latest
I inspect and know that IP of that container is 192.168.15.2. But I cannot access to this via 192.168.15.2 or ip:8080. However, when I'm using localhost:8080, it works!
Could pls show me what is the problem and how to fix it.
I think it's normal behavior on Docker Desktop for Windows. Please refer to docker-for-windows and windowscontainers

DNS not working between two linked docker containers - getaddrinfo EAI_AGAIN error

I am attempting to setup a temporary environment where I can execute ATs against a web application. To achieve this I have 3 docker containers:
Container 1: Database (mongo_local)
docker build -t mongo_local ./test/AT/mongo
docker run --name mongo_local -d -p 27017:27017 mongo_local
Container 2 (Web application):
docker run --name mywebapp_local -d -p 4431:4431 --link mongo_local -v /applicationdata:/applicationdata mywebapp
Container 3 (Newman test runner):
docker build -t newman_runner ./test/AT/newman
docker run --name newman_runner --link mywebapp_local newman_runner
The web application can access the database successfully using the following connection string: mongodb://mongo_local:27017/mydb, note that I am able to reference mongo_local, I dont have to specify an IP address for the mongo_local container.
The newman test runner runs postman tests against the web application and all tests execute successfully when I specify the IP address of the mywebapp_local container i.e. 10.0.0.4 in the URL, however if I specify the name mongo_local in the URL it does not work.
Hence https://mywebapp_local/api/v1/method1 does not work but https://10.0.0.4/api/v1/method1 does work.
The error Im getting is
getaddrinfo EAI_AGAIN mywebapp_local mywebapp_local:443 at request ...
I've tried using -add-host in the docker run command and this makes no difference. Is there anything obvious that I'm doing wrong?
As you have it set up, the newman_runner container doesn't --link mongo_local and that's why it can't see it.
Docker has been discouraging explicit inter-container links for a while. If you create a Docker-internal network and attach each container to it
docker network create testnet
docker run --net testnet ...
it will be able to see all of the other containers on the same network by their --name without an explicit --link.

the second wordpress is not working in docker

I am learning the docker technology.
I run two wordpress in docker at one host. but the second wordpress is not good for working.
I run one mysql server in docker and the two wordpresss share the sample mysql.
run docker server command at below:
sudo docker run --name mysql_db -e MYSQL_ROOT_PASSWORD=xxxx -d mysql
sudo docker run --name wordpress1 -e WORDPRESS_DB_NAME=wordpress1 --link
mysql_db:mysql -p 8008:80 -d wordpress
sudo docker run --name wordpress2 -e WORDPRESS_DB_NAME=wordpress2 --link
mysql_db:mysql -p 8009:80 -d wordpress
when I get the ip:8008 in IE, it is good,but get ip:8009, it redirect the ip:8008, i cann't get webpage from 8009 port.
So i look the second wordpress log, it show the http 302 error.
when I modify the 8009 to the 9009 and run the mysql and two wordpress in docker again, the second wordpress server is good, I can get webpage from ip:9009.
my mysql and wordpress image pull from the default office site.
so i cann't know when i modify the port 8009 to 9009, the second wordpress is working good. i cann't find the result through search.
docker --version
Docker version 17.06.0-ce, build 02c1d87
uname -a
Linux linux-1 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u3 (2015-08-04) x86_64 GNU/Linux
thks.
I think i find the reason.
I try more other ports to wordpress mapping , only the 8009 is not ok.
Because my docker is in public cloud host, i must through the firewall to get my web server, so i think the 8009 is reflected to 8008 in firewall.
It is not issue of docker and wordpress.
thanks all.

How to forward all ports in docker container

Consider:
docker run -p 5000:5000 -v /host/:/host appimage
it forwards 5000 to 50000
even in multiple:
docker run -p 5000:5000 -p 5001:5001 -v /host/:/host appimage
What I want to know is:
docker run -p allports:allports
is there any command available that allows to forward all ports in container? Because in my case I am running flask app. For testing purpose I want to run multiple flask instances. So for each flask instance I want to run it in different ports. This auto multi-port forwarding would help.
You can expose a range of ports using the -p option, for example:
docker run -p 2000-5000:2000-5000 -v /host/:/host appimage
See the docker run reference documentation for more details.
You might have a working set-up by using docker run --net host ..., in which case host's network is directly exposed to the continer and all port bindings are "public". I haven't tested this with multiple containers simultaneously but it might work just fine.

Resources