Running Firebase emulator with docker.
# build by default tag
$ make build
# run by default
$ make run
# ...
# ┌─────────────────────────────────────────────────────────────┐
# │ ✔ All emulators ready! It is now safe to connect your app. │
# │ i View Emulator UI at http://0.0.0.0:4000 │
# └─────────────────────────────────────────────────────────────┘
# ┌────────────────┬──────────────┬───────────────────────────────┐
# │ Emulator │ Host:Port │ View in Emulator UI │
# ├────────────────┼──────────────┼───────────────────────────────┤
# │ Authentication │ 0.0.0.0:9099 │ http://0.0.0.0:4000/auth │
# ├────────────────┼──────────────┼───────────────────────────────┤
# │ Firestore │ 0.0.0.0:8080 │ http://0.0.0.0:4000/firestore │
# ├────────────────┼──────────────┼───────────────────────────────┤
# │ Database │ 0.0.0.0:9000 │ http://0.0.0.0:4000/database │
# ├────────────────┼──────────────┼───────────────────────────────┤
# │ Pub/Sub │ 0.0.0.0:8085 │ n/a │
# ├────────────────┼──────────────┼───────────────────────────────┤
# │ Storage │ 0.0.0.0:9199 │ http://0.0.0.0:4000/storage │
# └────────────────┴──────────────┴───────────────────────────────┘
# ...
If run by default, you can view Emulator UI in your browser at localhost:4000
.
Emulator | Default Port |
---|---|
Emulator Suite UI | 4000 |
Cloud Firestore | 8080 |
Pub/Sub | 8085 |
Realtime Database | 9000 |
Authentication | 9099 |
Cloud Storage | 9199 |
PROJECT
environment when runnning docker# Example
$ docker run --rm \
-e PROJECT=my-project \
-p 4000:4000 \
-p 8080:8080 \
-p 8085:8085 \
-p 9000:9000 \
-p 9099:9099 \
-p 9199:9199 \
$(DOCKER_TAG)
# Example
# Create custom firebase.json
$ cat << EOF > my_firebase.json
{
"emulators": {
"ui": {
"enabled": true,
"host": "0.0.0.0",
"port": 4000
},
"firestore": {
"host": "0.0.0.0",
"port": 8080
}
}
}
EOF
# Mount custom firebase.json and specify ports when running docker
$ docker run --rm \
-v $(pwd)/my_firebase.json:/usr/firebase/firebase.json \
-p 4000:4000 \
-p 8080:8080 \
$(DOCKER_TAG)
# ...
# ┌─────────────────────────────────────────────────────────────┐
# │ ✔ All emulators ready! It is now safe to connect your app. │
# │ i View Emulator UI at http://0.0.0.0:4000 │
# └─────────────────────────────────────────────────────────────┘
# ┌───────────┬──────────────┬───────────────────────────────┐
# │ Emulator │ Host:Port │ View in Emulator UI │
# ├───────────┼──────────────┼───────────────────────────────┤
# │ Firestore │ 0.0.0.0:8080 │ http://0.0.0.0:4000/firestore │
# └───────────┴──────────────┴───────────────────────────────┘
# ...