How to restart flutter app in docker container?

231

Try this:

docker attach <container>

Press R. Press Ctrl-P Ctrl-Q to detach.

Share:
231
Wiktor
Author by

Wiktor

I am a High School student who learns programming on his own. In the past, I have mostly focused on getting knowledge and experience in Web Development. Currently I focus on Mobile Development with Flutter. When it comes to complex Back-End , Golang is my favourite choice, although I am not such a masochist to choose it over simplicity, which Firebase provides! I am not a big fan of being only a 'code writer', that's the reason why I've been learning basics of Assembly language. I want to understand truely how the computer works, so I can code much better optimalized applications! Apart from technologies pointed out above, I've also spent a lot of time on getting experience with Dev-Ops stuff . I always prefer my app to be containerized and have better infrastructure overall. Previosuly I was using Docker for that, now my goal is to be confident with Kubernetes. I am also a Linux User, familiar with Arch and Ubuntu distros, so Operating Systems don't scare me either!

Updated on December 27, 2022

Comments

  • Wiktor
    Wiktor over 1 year

    I am trying to restart flutter application running in Docker.

    I specified stdin_open and tty to true in docker-compose.yml file

    • This is the only one place in docker-compose.yml where I've specified stdin and tty.

      app:
        build:
          context: app
        restart: always
        stdin_open: true
        tty: true
        volumes:
          - ./app:/build
        ports:
          - "8080:8080"
        env_file:
          - ./env/flutter.env
        command: >
          sh -c "flutter pub get
          && flutter run -d web-server --web-port 8080 --web-hostname 0.0.0.0"
        depends_on:
          - server
      

    Running flutter web with docker-compose

    On the screen above it is visible that I cannot restart an application this way.

    I have to do it manually by using command: docker-compose up --detach --build

    Is there any way I can interact with this container and restart app by pressing "R" ?

    • David Maze
      David Maze over 3 years
      The docker-compose command you show is the normal way to do it.
    • Wiktor
      Wiktor over 3 years
      Okay, I understand. Thank you
  • Wiktor
    Wiktor over 3 years
    It doesn't work either. Same result as before
  • anemyte
    anemyte over 3 years
    @Wiktor can you provide some hello-world code so I can run flutter myself?
  • Wiktor
    Wiktor over 3 years
    pastebin.com/qEAEcECN This is the simplest one main file, but you need a lot of more files to build it. With flutter sdk, you can run flutter create <name> to create a ready to run flutter template.
  • anemyte
    anemyte over 3 years
    @Wiktor I tried many times to make it work with docker-compose but failed. It seems the only thing it forwards are process signals. On the other hand the solution I posted above worked well: i.imgur.com/LmBCXuy.png . I tried several launch configurations and there was no problem with restart by pressing R.
  • Wiktor
    Wiktor over 3 years
    Oh, I am sorry. It works, that's right. I had to attach it before it started running in the browser. Thank you very much