How to access docker container from another machine on local network

@astralix, because of the design of Docker, I think what you’re trying to do is quite difficult.

Now, I’m a noob so could be way off here, but it seems to me that Docker handles application sets… It doesn’t virtualise the OS or any of ‘that layer’, which is partly why you’re struggling to assign a unique IP to a container. I’m imagine there’s some brave methods of hackery via assigning multiple IPs to the host and attempting to ‘present’ the additional addresses to a given container, but it looks like an uphill battle to me.

I have however, stumbled across a particularly complicated guide with IPTables and whanot using macvlan networks here, but honestly, after skimming through, I couldn’t follow it. It’s definitely what you’re after, as the documentation talks about assigning a MAC to the container…

However, once I understood the container shares the same IP as the host, I got over it and enjoyed not banging my head against the wall.

  • Personally, I think you’d be better of moving ‘down the stack’ and exploring ESXi, Hyper-V, Xen etc, or digging into the macvlan thing.

Can you explain a way to do the same on linux?

Hi All , I am new to docker. I have java application which can be run using "javaws http://localhost:9088/rtccClient/rtcc.jnlp. I created docker container for the java application in my windows machine using “ibmcom/websphere-liberty:latest” as base image. now my windows machine has docker container where linux is there and my java application is running inside it . I exposed port 9080 in my docker file and i am trying to run application from my windows machine using command “javaws http://localhost:9080/rtccClient/rtcc.jnlp”. but it was not working
. can some one tell what is the mistake i am doing? below is my docker file.

FROM ibmcom/websphere-liberty:latest
USER root
RUN yum -y install unixODBC
RUN yum -y install libaio
RUN mkdir -pv /basic
RUN mkdir -pv /resources/security
COPY ./basicinstaclient/oracle-instantclient19.8-basic-19.8.0.0.0-1.x86_64.rpm /basic/
RUN rpm -i /basic/oracle-instantclient19.8-basic-19.8.0.0.0-1.x86_64.rpm
ADD ./rtcc.ear /opt/ibm/wlp/usr/servers/defaultServer/apps
ADD ./rtccClient.war /opt/ibm/wlp/usr/servers/defaultServer/apps
ADD ./resources/bootstrap.properties /opt/ibm/wlp/usr/servers/defaultServer
ADD ./resources/server.xml /opt/ibm/wlp/usr/servers/defaultServer
ADD ./resources/hibernate/ /opt/ibm/wlp/usr/servers/defaultServer/hibernate
ADD ./resources/oracle/ /opt/ibm/wlp/usr/servers/defaultServer/oracle
ADD ./certificates/ /opt/ibm/wlp/usr/servers/defaultServer/resources/security
EXPOSE 9080

below error i am getting
CouldNotLoadArgumentException[ Could not load file/URL specified: http://localhost:9080/rtccClient/rtcc.jnlp]

Hello!
I have been using docker to use a tool named Augustus.
But unable to use it in my local machine, where other tools will be using Augustus in the pipeline.
Kindly guide how can I go about it

I shall be highly obliged.
Thank you.

Hi,
I am new to docker…
I am having a remote Linux machine which is the docker host and where the docker container is running… I am able to ping docker container from my remote machine and vice versa… But I want to ping container ip directly from my local machine (MacOS)… Can anyone guide me on how can I access it?

Thanks in advance

I’m having a similar issue as you guys.

I have a perfectly functional system running Open WebUI, as follows:

  • Host system: Windows 11 with WSL running an Ubuntu 22.04.4 LTS
  • Ollama is installed within the WSL, using localhost:11434
  • Open WebUI: is installed inside a docker container within the WSL and it is accessible by the host system through the localhost:8080

I installed the docker container using:

$ docker run --runtime=nvidia -d --network=host --gpus all --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:cuda

I have no issues on accessing it in using my host system, but I’d like to know how could I access it from another computer in my network, from a browser just typing the fixed IP address of my machine like 192.168.x.x:8080.

I’d appreciate any suggestion or material I should read.

This is how WSL2 works.

You can google for these alternatives:

  • Porftforwarding: goole the search terms “WSL host ip portfowarding”
  • networking_mode: mirrored: google search terms: "wsl networkingMode mirrored`.
1 Like

Hi @meyay,

Thanks to your leads about where to get what I need I easily solved my issue, it was:

Port forwarding:
netsh interface portproxy add v4tov4 listenport=8080 listenaddress=0.0.0.0 connectport=8080 connectaddress=[WSL_IP]

Firewall rule creation:
New-NetFirewallRule -DisplayName “Allow WSL2 Port” -Description “To allow Open WebUI through the firewall.” -Direction Inbound -Action Allow -Protocol TCP -LocalPort 8080

Thanks for the support and for the leads!

1 Like