I've a docker container on my VM , exposing ports 5042, 7247. And I want to make it available from external networks. OS: Ubuntu 22.04.3 LTS
curl http://172.17.0.2:5042/v1/user/HasUsers gives me 200 OK but curl http://X.X.X.X:5042/v1/user/HasUsers gives CONN refused I tried to modify iptables like this:
-A PREROUTING -s X.X.X.X/32 -i eth0 -p tcp -m tcp --dport 5042 -j DNAT --to-destination 172.17.0.2:5042
-A PREROUTING -s X.X.X.X/32 -i eth0 -p tcp -m tcp --dport 7247 -j DNAT --to-destination 172.17.0.2:7247
docker:
docker run -v botticelli_server_back_dev:0.6 -p 7247:7247 -p 5042:5042 -e ASPNETCORE_ENVIRONMENT="Development" -e SecureStorageSettings__ConnectionString="$SecureStorageSettings__ConnectionString" -e ServerSettings__TokenLifetimeMin="$ServerSettings__TokenLifetimeMin" -e ServerSettings__SmtpClientOptions__Server = "$ServerSettings__SmtpClientOptions__Server" -e ServerSettings__SmtpClientOptions__Port = "$ServerSettings__SmtpClientOptions__Port" -e ServerSettings__SmtpClientOptions__User = "$ServerSettings__SmtpClientOptions__User" -e ServerSettings__SmtpClientOptions__Password = "$ServerSettings__SmtpClientOptions__Password" -e ServerSettings__SmtpClientOptions__UseSsl = "$ServerSettings__SmtpClientOptions__UseSsl" -e ServerSettings__SmtpClientOptions__RequiresAuthentication = "$ServerSettings__SmtpClientOptions__RequiresAuthentication" -e ServerSettings__SmtpClientOptions__PreferredEncoding = "$ServerSettings__SmtpClientOptions__PreferredEncoding" -e ServerSettings__SmtpClientOptions__UsePickupDirectory = "$ServerSettings__SmtpClientOptions__UsePickupDirectory" -e ServerSettings__SmtpClientOptions__MailPickupDirectory = "$ServerSettings__SmtpClientOptions__MailPickupDirectory" -e ServerSettings__SmtpClientOptions__SocketOptions = "$ServerSettings__SmtpClientOptions__SocketOptions" -e ServerSettings__ServerEmail = "$ServerSettings__ServerEmail" -e ServerSettings__ServerUrl = "$ServerSettings__ServerUrl" -v /data:/data -v /logs:/logs -v /tmp:/tmp
but still no effect (( May you help me?