Kindly let me know below
- how to connect db (running on other host) while running container as app inside container needs DB to initialize.
- Checking traces for container if DB bind is successful and app is initialized properly.
Kindly let me know below
If i understand you correctly, you should be able to connect to your mysql host just as if you would in a normal application, your container will be able to resolve and connect to the mysql host.
I belive your application should check if it has connected or not
i think its not getting resolved as getting below exception
Local Port(10.0.2.x:9091) => bind()… FAILED. Error: Cannot assign requested address
HTTP SERVER PORT  ALREADY IN USE
Here 10.0.2.x is local host IP where I m running container and 9091 is port.
What else is using this port?
How do you start your application container?
Exactly what gives you this error message? I thought you had problem with the mysql connection but it says HTTP SERVER PORT.
I am executing .sh file in Dockerfile which will initialize/start application while running container but while running container I can’t see any application running may be due to this exception “HTTP SERVER PORT  ALREADY IN USE” if I am running this .sh file manually inside container I am getting this exception but if i am checking port then it’s say’s below.
[root@imi-hyd-rnd1 pjsip]# docker port 47503b8ee746 9091
Error: No public port ‘9091/tcp’ published for 47503b8ee746
Below is extract of Dockerfile for reference.
One more thing I m suspecting is right now under application host IP is mentioned which is used for starting application and as container doesn’t know regarding host IP that’s why this address & port conflict.
Is there any way that container should use host IP?
Okay, I don’t think we can help you unless you give us more information. Until now everything you gave us hid what you really did.
10.0.2.xbut you mentioned later that you checked the port on the host with an other IP address (
Your last post I just don’t understand. Maybe it’s just me, but could you share what you are trying to do from the beginning step by step, providing us more information with commands and everything you are allowed to share? If you are not allowed to share something, for example the name of the application or the type of the HTTP server, please tell us that so we will not ask you about that again.
Yes, I do agree but after trouble shooting DB connectivity is resolved automatically by container and also http exception was due to host IP not getting bind to container, using --network=“host” flag while running container sorted problem, now both db & http exception is sorted out, thanks.
generally while running container application should start automatically (here application defined in Docker file is dvp_9091.sh) but it my case it’s not getting started, if I am starting .sh file manually from container it’s starting properly below are details. Kindly look into it.
FROM centos:centos7.9.2009 RUN mkdir /pjsip WORKDIR /pjsip COPY davincisip /pjsip RUN mkdir /usr/local/lib64/imidbconnector1 ADD imidbconnector1 /usr/local/lib64/imidbconnector1 RUN mkdir /usr/lib64/mysql ADD mysql /usr/lib64/mysql COPY libcryptopp.so.6.0.0 libspandsp.so.2.0.0 libnetsnmp.so.31.0.2 libtiff.so.5.2.0 libaio.so.1 libjbig.so.2.0 libjpeg.so.62 /usr/lib64/ RUN cd /usr/lib64 && ln -s libcryptopp.so.6.0.0 libcryptopp.so.6 && ln -s libspandsp.so.2.0.0 libspandsp.so.2 && ln -s libnetsnmp.so.31.0.2 libnetsnmp.so.31 && ln -s libtiff.so.5.2.0 libtiff.so.5 #RUN dnf install net-tools EXPOSE 9091 CMD /pjsip/dvp_9091.sh
docker run -it --network="host" pjsip /bin/bash
First of all, thank you for sharing the Dockerfile. I edited your post so the code is formatted properly. Please, use
</> button when you write your message to highlight codes. If you don’t do that, the markdown filter can totally ruin your code so we don’t understand it.
Seeing your code I realized where your current “adventure” started so I leave it here for others before they ask why you copy binaries from the host, although I wouldn’t do that either and it can cause issues if you don’t do it right.
So if I understand well, you solved everything. That’s great
Is I am doing something wrong by copying code from host to container? here already compiled code is there which I am mentioning in mentioning in .sh and same .sh file i am using to start app. i don’t know if I am doing something wrong, need your assistance.
Also further to last post currently git/svn repository I am not preferring due to some security concern, if .sh file I am able to start properly manually inside container then why it’s not getting initialized automatically is main thing, if I am doing something wrong please let me know so that this problem can be sorted out.
I wouldn’t start a conversation about copying libraries here but It is clearly something nobody does. You install the libraries using apt or dnf for example or build them from source code. If you copy a library to the wrong place then nothing works…