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.

Dockerize web-based Flet Application

See original GitHub issue

I am not a really expert on docker but following the https://flet.dev/docs/guides/python/deploying-web-app/fly-io, I wanted to try my demo in my own computer. When I run the app from my local virtual env, the web app is displayed without problem. However, when I try to run it from a docker container, even when the container is running without issues, it give me error: (failed)net::ERR_EMPTY_RESPONSE

Docker commands used to create the image and run the container docker build --tag flet-app:latest . docker run -it -p 62590:62590 -p 8080:8080 flet-app

Source Code

import flet as ft

def main(page: ft.Page):
    page.add(ft.Text(value="Hello world from containerized Flet app!"))

ft.app(target=main, view=ft.WEB_BROWSER)

dockerfile

# syntax=docker/dockerfile:1

FROM python:3.8-slim-buster

WORKDIR /app

COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt

COPY . . 

EXPOSE 8080 62590

CMD ["python", "./app/main.py"] 

Issue Analytics

  • State:open
  • Created 10 months ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
arminuscommented, Nov 28, 2022

I think the key here is that you start your app with

ft.app(target=main, port=8080, view=ft.WEB_BROWSER)

Then you don’t need to expose 62590 - which is pointless anyway, because unless you specify the port for ft.app(…) explicitly, fletd starts on a random port which your Docker will never know about.

At any rate, this way, my brief test worked.

1reaction
FeodorFitsnercommented, Nov 23, 2022

Try this Dockerfile which works great for Fly.io environment. Let me know if that worked.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Docker | JetBrains Fleet Documentation
Docker is a tool for deploying and running executables in isolated and reproducible environments. This may be useful, for example, ...
Read more >
linuxserver/fleet - Docker Image
Fleet - an online web interface which displays all of our maintained images. GitHub - view the source for all of our repositories....
Read more >
Deploying a scalable web application with Docker and ...
Deploying a scalable web application with Docker and Kubernetes. Learn how to test and deploy a Node.js app using containers and an ...
Read more >
Docker Provider | Fleet and Elastic Agent Guide [master]
Manage Elastic Agents in Fleet ... Provides inventory information from Docker. ... For example, the Docker provider provides the following inventory:.
Read more >
Part 53 - Dockerize FleetMS (SpringBoot) With MySQL Database
This is Part 53 of our complete application in Spring Boot (FleetMS version 2). In this part, we would learn how to dockerize...
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