Git Product home page Git Product logo

Comments (6)

kevinlinxc avatar kevinlinxc commented on September 23, 2024 1

Here's a video of it not working. I upgraded the Dockerfile to python:3.9 which gets rid of the error from #2.

pyzmq-docker-windows-problem

System info: Windows 11 Education, version 22H2. I had some team members try too, probably not on Education version.
Docker is running with a WSL 2 backend.

from pyzmq-docker.

kevinlinxc avatar kevinlinxc commented on September 23, 2024 1

We have a bunch of apps that we do docker compose. However, some of our apps have GUIs (pyqt) and getting the Gui out of docker seems really painful, so we have to communicate from the outside to the inside.

from pyzmq-docker.

NumesSanguis avatar NumesSanguis commented on September 23, 2024

Hi Kevin, I was planning to take a look at this over the weekend, but unfortunately didn't get to it.

I ran this (long ago) on Linux and Windows (not Mac, so thanks for testing that).
Do you think this is related to your issue: #2 ?

Could you provide a bit more details of what you have tried and your system? What version of Windows are you using (version number and whether it is the Home or Enterprise/Education version)? How did you install Docker (WSL 2 backend or Hyper-V)?

from pyzmq-docker.

NumesSanguis avatar NumesSanguis commented on September 23, 2024

From your screen recording I see you went for setup 3b in the README.

  • Pub: python main.py
  • Sub: docker run -p 5551:5551 -it foo/sub

I tested on my Windows 10 PC with Docker setup using WSL 2 and indeed I faced the same issue (after upgrading Docker image to python:3.10-slim).

It seems that even just pure Python (setup 1, no Docker) also faces the same issue. It might be firewall related as changing the IP solved the issue.

Solution local PC

For your publisher, try this code instead:

python main.py --ip 127.0.0.1

This changes the IP from 0.0.0.0 (your LAN network) to 127.0.0.1 (just your local PC),
Now you should messages appear in your Docker sub instance.
Note that might cause issues if your sub instance runs on another PC, but at least we're 1 step further now.

Solution across PCs

Unfortunately IP 0.0.0.0 doesn't seem to work on W10 and W11, so instead give it your LAN network IP.
Get you IP on Windows with:

ipconfig

and look for something that looks like:

IPv4 Address. . . . . . . . . . . : 172.16.0.112

This means you have to run the Publisher with:

python main.py --ip 172.16.0.112

(Didn't test it across 2 PCs, so let me know if it didn't work)

Other

For me setup 2 (docker-compose up --build) does work on Windows 10 with the IP still being the default 0.0.0.0.

Hope this helps!

from pyzmq-docker.

kevinlinxc avatar kevinlinxc commented on September 23, 2024

Pub

python main.py --ip 127.0.0.1

Sub

docker run  -p 5551:5551 -it foo/sub

worked for me. Thanks! I don't have time to test across two PCs, my use case is just for one PC anyway so this is perfect. If I understand correctly though, I think you could get the IP automatically on some platforms with

import socket
socket.gethostbyname(socket.gethostname())

from pyzmq-docker.

NumesSanguis avatar NumesSanguis commented on September 23, 2024

Glad it worked out for you @kevinlinxc !

Just out of interest, is there a reason why you're using a Python - Dockerized Python setup? Rather than having all scripts Dockerized and using docker-compose?

from pyzmq-docker.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.