oatpp / oatpp-starter

Oatpp simple-API starter project
https://oatpp.io/
Apache License 2.0
72 stars 35 forks source link

error at docker #13

Closed KaungZawHtet closed 3 years ago

KaungZawHtet commented 3 years ago

When I run in ./my-project-exe at /service/build on docker, the err is shown :

 E |2020-10-11 19:00:01 1602442801238882| [oatpp::network::tcp::server::ConnectionProvider::instantiateServer()]:Error. Couldn't bind. Address not available
terminate called after throwing an instance of 'std::runtime_error'
  what():  [oatpp::network::tcp::server::ConnectionProvider::instantiateServer()]: Error. Couldn't bind Address not available
Aborted

Is there something I missed ?

lganzzzo commented 3 years ago

Hey @KaungZawHtet ,

I've changed connection provider settings to:

return oatpp::network::tcp::server::ConnectionProvider::createShared({"0.0.0.0", 8000, oatpp::network::Address::IP_4});

Now it should work.

You can also play with host, and IP version.

Please let me know if it works for you now.

Regards, Leonid

KaungZawHtet commented 3 years ago

Same problem:

E |2020-10-11 21:33:13 1602451993394144| [oatpp::network::tcp::server::ConnectionProvider::instantiateServer()]:Error. Couldn't bind. Address in use
terminate called after throwing an instance of 'std::runtime_error'
  what():  [oatpp::network::tcp::server::ConnectionProvider::instantiateServer()]: Error. Couldn't bind Address in use
Aborted
lganzzzo commented 3 years ago

Hey @KaungZawHtet ,

Not the same:

In the first case, you had

Error. Couldn't bind Address not available - # like for example if you were trying to use IPv6 addr which was not available.

And in the second case:

Error. Couldn't bind Address in use - # Mean that you already have some service running on that address.

So, you have to check if something already running on the address. Or change the host/port.


You may check this for more info on the last error - https://stackoverflow.com/questions/15198834/bind-failed-address-already-in-use

KaungZawHtet commented 3 years ago

received "helloworld" from localhost:8000/ on browser It means I m ok now, right ?

lganzzzo commented 3 years ago

Yes.

lganzzzo commented 3 years ago

It should json

{"statusCode":200,"message":"Hello World!"}
KaungZawHtet commented 3 years ago

ok, got it. Thx for ur help. Now this can be closed now

lganzzzo commented 3 years ago

Great, Please let me know in case of other issues.