2021-10-19
1486
#docker#flutter
Damilare Jolayemi
72066
Oct 19, 2021 ⋅ 5 min read

Containerizing Flutter web apps with Docker

Damilare Jolayemi Damilare is an enthusiastic problem-solver who enjoys building whatever works on the computer. He has a knack for slapping his keyboards till something works. When he's not talking to his laptop, you'll find him hopping on road trips and sharing moments with his friends, or watching shows on Netflix.

Recent posts:

How to use TOON to reduce your token usage by 60%

TOON is a lightweight format designed to reduce token usage in LLM prompts. This post breaks down how it compares to JSON, where the savings come from, and when it actually helps.

Rosario De Chiara
Dec 10, 2025 ⋅ 5 min read
Fixing AI Generated Code

Fixing AI-generated code: 5 ways to debug, test, and ship safely

Andrew Evans, principal engineer and tech lead at CarMax discusses five ways to fix AI-generated code and help you debug, test, and ship safely.

Andrew Evans
Dec 10, 2025 ⋅ 9 min read
Apple Liquid Glass LogRocket

How to create Liquid Glass effects with CSS and SVG

This tutorial walks through recreating Apple’s Liquid Glass UI on the web using SVG filters, CSS, and React. You’ll learn how to build refraction and reflection effects with custom displacement and specular maps, and how to balance performance and accessibility when using advanced filter pipelines.

Rahul Chhodde
Dec 8, 2025 ⋅ 10 min read
tRPC vs ORPC: Which is better for your next TypeScript project, and why?

tRPC vs oRPC: Which is better for your next TypeScript project, and why?

tRPC solved type safety for full-stack TypeScript teams. oRPC borrowed the best parts and added interoperability. This article breaks down how both frameworks work and where each one fits best.

Temitope Oyedele
Dec 8, 2025 ⋅ 22 min read
View all posts

9 Replies to "Containerizing Flutter web apps with Docker"

  1. Hi, thanks for the great explanation on how to run flutter in a container, but I need to add something.

    In the Dockerfile
    1.) You need to remove the 1st line from “sh”
    2.) Add these 2 lines to the Docker file
    ENV TZ=Europe/Warsaw
    RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

    This is necessary because apt-get wants to install the “libgconf-2-4” package and tzdata and we need to answer the question about TIMEZONE during installation/configuration. These 2 lines in the Dockerfile can configure TIMEZONE automatically.

    Of course, we can also run nginx as a replacement with “python3 -m http.server $PORT” but that’s another story 🙂

    1. After which line do we have to add the below line in Dockerfile?

      ENV TZ=Europe/Warsaw
      RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

  2. ERROR: while running ` docker build -t flutter_web_test . `

    => ERROR [ 3/14] RUN apt-get install -y curl git wget unzip libgconf-2-4 gdb libstdc 1.1s
    ——
    > [ 3/14] RUN apt-get install -y curl git wget unzip libgconf-2-4 gdb libstdc++6 libglu1-mesa fonts-droid-fallback lib32stdc++6 python3:
    #6 0.329 Reading package lists…
    #6 0.934 Building dependency tree…
    #6 1.060 Reading state information…
    #6 1.108 E: Unable to locate package lib32stdc++6
    #6 1.108 E: Couldn’t find any package by regex ‘lib32stdc++6’
    ——
    executor failed running [/bin/sh -c apt-get install -y curl git wget unzip libgconf-2-4 gdb libstdc++6 libglu1-mesa fonts-droid-fallback lib32stdc++6 python3]: exit code: 100

  3. answer to why it is not working on M1
    As you noticed yourself, you are starting a docker build based on an image that was built for another platform, i.e. you are running arm64 but the image is linux/amd64. This means that docker will run it but with an emulation layer, namely qemu.

    Some incompatibility between Dart and qemu seems to be the problem. In the stacktrace you posted, qemu crashed when Dart runtime tried to execute InvokeCode(). This is actually a reported problem, see e.g.

    dart-lang github issue: Building linux/amd64 Docker Image on Mac M1 (most relevant, I think)
    flutter github: build flutter(3.0.3) docker image base on ubuntu:18.04 crash
    another flutter issue: Unable to ‘pub upgrade’ flutter tool
    answer to what to do
    The Dart folks have no plans to analyze this any further since the problem lies with qemu and the problem was not reproduced with qemu outside docker.

    It is also noteworthy that docker with qemu is only provided as a best effort and the docker project itself is unlikely to tackle the issue either, even if reported.

    I did not find a filed issue for qemu itself.

    There are basically two options:

    Do the thing without qemu, meaning to build in a linux/arm64 container
    This will work to some degree regarding flutter, but the next thing you will have to tackle is arm-based android build for linux, which is a whole new can of worms. See e.g. google’s android bug tracker, Please support Linux aarch64 for building apps and others.

    Do the build without arm/M1 hardware
    As sad as it is to realize this, it might be the straightforward solution to not cross-build in this case, at least for flutter with android build target. And likely also a logical one if you want to provide an intel compatible docker image to coworkers and/or CI which might not run M1. Ultimately, it is a question what your reference build platform is.

  4. It was working fine, but for some reason now I always get this error:

    exec /app/server/server.sh: no such file or directory

    Does anyone have a solution for that?

  5. Following steps to much time run

    => [ 3/14] RUN apt-get install -y curl git wget unzip libgconf-2-4 gdb libstdc++6 libglu1-mesa fonts-droid-fallback l 735.5s
    => => # questions will narrow this down by presenting a list of cities, representing
    => => # the time zones in which they are located.
    => => # 1. Africa 4. Australia 7. Atlantic 10. Pacific 13. Etc
    => => # 2. America 5. Arctic 8. Europe 11. SystemV
    => => # 3. Antarctica 6. Asia 9. Indian 12. US
    => => # Geographic area:

    Any Idea why it takes to much time?

  6. The above docker file is build around 1.92 GB flutter mage. Is there any way to reduce that image size?

Leave a Reply

Hey there, want to help make our blog better?

Join LogRocket’s Content Advisory Board. You’ll help inform the type of content we create and get access to exclusive meetups, social accreditation, and swag.

Sign up now