我有这个泊坞窗文件:
FROM node:16
ADD . /src
WORKDIR /src
# Install OpenJDK-11
RUN echo 'deb http://ftp.debian.org/debian stretch-backports main' | tee /etc/apt/sources.list.d/stretch-backports.list
RUN apt-get update && \
apt-get install -y openjdk-11-jre-headless && \
apt-get clean;
RUN npm i -g firebase-tools
RUN firebase --version
EXPOSE 9099 4000
我有这个 firebase.json:
{
"emulators": {
"auth": {
"port": 9099
},
"ui": {
"enabled": true,
"port": 4000
}
}
}
我有这个 docker-compose 文件:
version: "3.0"
services:
firebase:
build:
context: .
dockerfile: Dockerfile.firebase-emulator
volumes:
- ./fb-data:/src
ports:
- "9099:9099"
- "4000:4000"
stdin_open: true
tty: true
然后我跑docker exec -it <container-id> sh
并开始在里面运行这些命令:
firebase login --no-localhost
firebase emulators:start --project demo-test
结果是这样的:
当我在浏览器中访问 http://localhost:4000/auth
结果是:
暴露的docker端口有问题吗?
感谢您的帮助!
经过更多挖掘,为了使其工作,firebase.json 需要具有“host”属性:
{
"emulators": {
"auth": {
"port": 9099,
"host": "0.0.0.0"
},
"ui": {
"enabled": true,
"host": "0.0.0.0",
"port": 4000
}
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)