XWiki can't connect to remote SOLR using docker

Hello, i am trying to connect xwiki to remote solr on the same machine using containers. I have realized that containers are aware of each other in the docker network however they are unable to connect with java to create Xwiki’s cores i suppose. On the other hand i can log into these ports (80 and 8983) through the telnet. I have been searching on google, xwiki docs and xwiki forum however nobody met similar problem. I work with the latest version of Solr and Xwiki. Here are some logs:

sudo docker run --name solr -p 8983:8983 -v /home/centos/predefined_essentials_solr:/docker-entrypoint-initdb.d -v /home/centos/solrdata:/opt/solr/server/solr/xwiki solr

In predefined_essentials_solr i have got solr.init.sh and xwiki-platform-search-solr-server-data-12.2.jar

sudo docker run --name xwiki -p 80:8080 -v /home/centos/xwiki:/usr/local/xwiki -e DB_USER=xwiki -e DB_PASSWORD=xwiki -e DB_DATABASE=xwiki -e DB_HOST=<IP_1> -e INDEX_HOST=solr -e INDEX_PORT=8983 -e JAVA_OPTS="$JAVA_OPTS -Dhttp.proxyHost=<IP_2> -Dhttp.proxyPort= -Dhttps.proxyHost=<IP_2> -Dhttps.proxyPort= -Dhttp.nonProxyHosts="<IP_1>|localhost|127.0.0.1" -Xmx512m -XX:MaxPermSize=196m $XWIKI_OPTS" xwiki:lts-postgres-tomcat

2021-07-21 08:52:47,732 [localhost-startStop-1] INFO iPropertiesConfigurationSource - Loading [xwiki.properties] from [file:/usr/local/tomcat/webapps/ROOT/WEB-INF/xwiki.properties]
2021-07-21 08:52:47,981 [localhost-startStop-1] INFO o.x.e.i.ServletEnvironment - Using permanent directory [/usr/local/xwiki/data]
2021-07-21 08:52:56,487 [localhost-startStop-1] ERROR o.x.s.s.i.RemoteSolr - Failed to create the Solr client for core with name [events]
org.xwiki.search.solr.SolrException: Failed to get the list of field types
at org.xwiki.search.solr.AbstractSolrCoreInitializer.getFieldTypes(AbstractSolrCoreInitializer.java:166)
at org.xwiki.search.solr.AbstractSolrCoreInitializer.getFieldType(AbstractSolrCoreInitializer.java:403)
at org.xwiki.search.solr.AbstractSolrCoreInitializer.getVersion(AbstractSolrCoreInitializer.java:390)
at org.xwiki.search.solr.AbstractSolrCoreInitializer.getCurrentXWikiVersion(AbstractSolrCoreInitializer.java:366)
at org.xwiki.search.solr.AbstractSolrCoreInitializer.initializeBaseSchema(AbstractSolrCoreInitializer.java:201)
at org.xwiki.search.solr.AbstractSolrCoreInitializer.initialize(AbstractSolrCoreInitializer.java:150)
at org.xwiki.search.solr.internal.AbstractSolr.getSynchronizedClient(AbstractSolr.java:95)
at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1705)
at org.xwiki.search.solr.internal.AbstractSolr.getClient(AbstractSolr.java:71)
at org.xwiki.search.solr.internal.DefaultSolr.getClient(DefaultSolr.java:67)
at org.xwiki.eventstream.store.solr.internal.SolrEventStore.initialize(SolrEventStore.java:154)
at org.xwiki.component.embed.InitializableLifecycleHandler.handle(InitializableLifecycleHandler.java:39)
at org.xwiki.component.embed.EmbeddableComponentManager.createInstance(EmbeddableComponentManager.java:365)
at org.xwiki.component.embed.EmbeddableComponentManager.getComponentInstance(EmbeddableComponentManager.java:451)
at org.xwiki.component.embed.EmbeddableComponentManager.getInstance(EmbeddableComponentManager.java:201)
at org.xwiki.eventstream.internal.DefaultEventStore.initialize(DefaultEventStore.java:99)
at org.xwiki.component.embed.InitializableLifecycleHandler.handle(InitializableLifecycleHandler.java:39)
at org.xwiki.component.embed.EmbeddableComponentManager.createInstance(EmbeddableComponentManager.java:365)
at org.xwiki.component.embed.EmbeddableComponentManager.getComponentInstance(EmbeddableComponentManager.java:451)
at org.xwiki.component.embed.EmbeddableComponentManager.getInstance(EmbeddableComponentManager.java:201)
at org.xwiki.component.embed.EmbeddableComponentManager.getDependencyInstance(EmbeddableComponentManager.java:406)
at org.xwiki.component.embed.EmbeddableComponentManager.createInstance(EmbeddableComponentManager.java:355)
at org.xwiki.component.embed.EmbeddableComponentManager.getComponentInstance(EmbeddableComponentManager.java:451)
at org.xwiki.component.embed.EmbeddableComponentManager.getInstance(EmbeddableComponentManager.java:201)
at org.xwiki.component.embed.EmbeddableComponentManager.getDependencyInstance(EmbeddableComponentManager.java:406)
at org.xwiki.component.embed.EmbeddableComponentManager.createInstance(EmbeddableComponentManager.java:355)
at org.xwiki.component.embed.EmbeddableComponentManager.getComponentInstance(EmbeddableComponentManager.java:451)
at org.xwiki.component.embed.EmbeddableComponentManager.getInstanceMap(EmbeddableComponentManager.java:242)
at org.xwiki.component.embed.EmbeddableComponentManager.getInstanceList(EmbeddableComponentManager.java:225)
at org.xwiki.observation.internal.DefaultObservationManager.initializeListeners(DefaultObservationManager.java:166)
at org.xwiki.observation.internal.DefaultObservationManager.getListenersByEvent(DefaultObservationManager.java:132)
at org.xwiki.observation.internal.DefaultObservationManager.notify(DefaultObservationManager.java:283)
at org.xwiki.observation.internal.DefaultObservationManager.notify(DefaultObservationManager.java:337)
at org.xwiki.container.servlet.XWikiServletContextListener.contextInitialized(XWikiServletContextListener.java:127)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4763)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5232)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:755)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:729)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1177)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1925)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.apache.solr.client.solrj.SolrServerException: Server refused connection at: http://localhost:8983/solr/xwiki_events
at org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:672)
at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:265)
at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:248)
at org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:211)
at org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:228)
at org.xwiki.search.solr.AbstractSolrCoreInitializer.getFieldTypes(AbstractSolrCoreInitializer.java:164)
… 46 common frames omitted
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:8983 [localhost/127.0.0.1] failed: Connection refused (Connection refused)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:156)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:376)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
at org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:564)
… 51 common frames omitted
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.base/java.net.Socket.connect(Socket.java:609)
at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:75)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
… 61 common frames omitted
2021-07-21 08:52:59,090 [localhost-startStop-1] ERROR o.x.s.s.i.RemoteSolr - Failed to create the Solr client for core with name [extension_index]
org.xwiki.search.solr.SolrException: Failed to get the list of field types
at org.xwiki.search.solr.AbstractSolrCoreInitializer.getFieldTypes(AbstractSolrCoreInitializer.java:166)
at org.xwiki.search.solr.AbstractSolrCoreInitializer.getFieldType(AbstractSolrCoreInitializer.java:403)
at org.xwiki.search.solr.AbstractSolrCoreInitializer.getVersion(AbstractSolrCoreInitializer.java:390)
at org.xwiki.search.solr.AbstractSolrCoreInitializer.getCurrentXWikiVersion(AbstractSolrCoreInitializer.java:366)
at org.xwiki.search.solr.AbstractSolrCoreInitializer.initializeBaseSchema(AbstractSolrCoreInitializer.java:201)
at org.xwiki.search.solr.AbstractSolrCoreInitializer.initialize(AbstractSolrCoreInitializer.java:150)
at org.xwiki.search.solr.internal.AbstractSolr.getSynchronizedClient(AbstractSolr.java:95)
at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1705)
at org.xwiki.search.solr.internal.AbstractSolr.getClient(AbstractSolr.java:71)
at org.xwiki.search.solr.internal.DefaultSolr.getClient(DefaultSolr.java:67)
at org.xwiki.extension.index.internal.ExtensionIndexStore.initialize(ExtensionIndexStore.java:163)
at org.xwiki.component.embed.InitializableLifecycleHandler.handle(InitializableLifecycleHandler.java:39)
at org.xwiki.component.embed.EmbeddableComponentManager.createInstance(EmbeddableComponentManager.java:365)
at org.xwiki.component.embed.EmbeddableComponentManager.getComponentInstance(EmbeddableComponentManager.java:451)
at org.xwiki.component.embed.EmbeddableComponentManager.getInstance(EmbeddableComponentManager.java:201)
at org.xwiki.component.embed.EmbeddableComponentManager.getDependencyInstance(EmbeddableComponentManager.java:406)
at org.xwiki.component.embed.EmbeddableComponentManager.createInstance(EmbeddableComponentManager.java:355)
at org.xwiki.component.embed.EmbeddableComponentManager.getComponentInstance(EmbeddableComponentManager.java:451)
at org.xwiki.component.embed.EmbeddableComponentManager.getInstanceMap(EmbeddableComponentManager.java:242)
at org.xwiki.component.embed.EmbeddableComponentManager.getInstanceList(EmbeddableComponentManager.java:225)
at org.xwiki.observation.internal.DefaultObservationManager.initializeListeners(DefaultObservationManager.java:166)
at org.xwiki.observation.internal.DefaultObservationManager.getListenersByEvent(DefaultObservationManager.java:132)
at org.xwiki.observation.internal.DefaultObservationManager.notify(DefaultObservationManager.java:283)
at org.xwiki.observation.internal.DefaultObservationManager.notify(DefaultObservationManager.java:337)
at org.xwiki.container.servlet.XWikiServletContextListener.contextInitialized(XWikiServletContextListener.java:127)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4763)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5232)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:755)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:729)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1177)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1925)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.apache.solr.client.solrj.SolrServerException: Server refused connection at: http://localhost:8983/solr/xwiki_extension_index
at org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:672)
at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:265)
at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:248)
at org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:211)
at org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:228)
at org.xwiki.search.solr.AbstractSolrCoreInitializer.getFieldTypes(AbstractSolrCoreInitializer.java:164)
… 37 common frames omitted
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:8983 [localhost/127.0.0.1] failed: Connection refused (Connection refused)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:156)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:376)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
at org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:564)
… 42 common frames omitted
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.base/java.net.Socket.connect(Socket.java:609)
at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:75)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
… 52 common frames omitted
2021-07-21 08:52:59,120 [localhost-startStop-1] INFO o.x.s.f.i.FilesystemStoreTools - Using filesystem store directory [/usr/local/xwiki/data/store/file]
2021-07-21 08:52:59,967 [OfficeProcessThread-0] WARN o.j.o.ConnectRetryable - Office process died with exit code 81; restarting it
2021-07-21 08:53:00,505 [localhost-startStop-1] INFO o.x.o.i.s.DefaultOfficeServer - Open Office instance started.
21-Jul-2021 08:53:01.518 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/ROOT] has finished in [20,433] ms
21-Jul-2021 08:53:01.531 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler [“http-nio-8080”]
21-Jul-2021 08:53:01.557 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 20602 ms

I would be glad if somebody could point me out what is more going on here.
Many thanks in advance.