Reputation: 443
I was trying to run a flutter web application but I can't see it running in localhost
.
I have this message that is running but I can't see it in my browser.
dashboard_1 | lib/main.dart is being served at http://localhost:8080
Dockerfile
FROM cirrusci/flutter AS build
RUN apt update && apt install -y nginx
RUN flutter channel beta
RUN flutter upgrade
RUN flutter config --enable-web
RUN mkdir /app/
COPY . /app/
WORKDIR /app/
RUN flutter build web
docker-compose.yml
version: '3.1'
services:
dashboard:
build: .
restart: on-failure
ports:
- "8080:8080"
command: >
sh -c "flutter pub get && flutter run -d web-server --web-port 8080"
Upvotes: 0
Views: 1966
Reputation: 443
I just added --web-hostname 0.0.0.0
to end of the docker-compose.yml
command and it works. But instead of localhost:8080
now is 0.0.0.0:8080
.
So the docker-compose.yml
looks like this:
version: '3.1'
services:
dashboard:
build: .
restart: always
ports:
- "8080:8080"
command: >
sh -c "flutter pub get && flutter run -d web-server --web-port 8080 --web-hostname 0.0.0.0"
Upvotes: 2