question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

http requests connect, but websockets do not when running inside docker

See original GitHub issue

Summary

When running streamlit hello inside a docker container, I am able to connect to the web server, but none of the web socket requests succeed. This occurs in both docker and kubernetes.

Steps to reproduce

running the Dockerfile:

FROM ubuntu:latest

RUN pip3 install streamlit

ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8

RUN mkdir -p /root/.streamlit/
RUN echo '[general]\nemail = "a@a.a"' > /root/.streamlit/credentials.toml

CMD streamlit hello

run docker run -p 8501:8501 --rm -it streamlit

image

Debug info

  • Streamlit version: 0.47.4
  • Python version: 3.6.8
  • Using Conda? PipEnv? PyEnv? Pex? no
  • OS version: ubuntu:latest
  • Browser version: Chrome Version 76.0.3809.132

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
dwielcommented, Oct 7, 2019

It seems that adding the following into ~/.streamlit/config.toml did the trick.

[server]
enableCORS = false

Still, it would be nice not to have to do this, or to get an error message that might suggest it.

0reactions
monchiercommented, Mar 4, 2020

Closing since fix has been merged: https://github.com/streamlit/streamlit/pull/965 Please reopen if this is not the case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do you dockerize a WebSocket Server? - Stack Overflow
Your server needs to listen on it's external interface, not localhost. Try changing localhost:8000 in the server code to 0.0. 0.0:8000 .
Read more >
Connection refused? Docker networking and how it impacts ...
Learn how to fix connection refused errors when trying to connect to a Docker container.
Read more >
Replicator does not connect to endpoint when run in Docker ...
I'm writing a Java app that will be responsible for doing some work and persisting that work to the database. The app is...
Read more >
25. WebSocket Support - Spring
This part of the reference documentation covers Spring Framework's support for WebSocket-style messaging in web applications including use of STOMP as an ...
Read more >
Troubleshooting connection issues | Socket.IO
If that's not the case, please check that the Socket.IO server is running, and that there is nothing in between that prevents the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found