Compiled successfully!
web_1 |
web_1 | You can now view react-docker-app in the browser.
web_1 |
web_1 | Local: http://localhost:3000
web_1 | On Your Network: http://172.18.0.2:3000
web_1 |
web_1 | Note that the development build is not optimized.
web_1 | To create a production build, use yarn build.
web_1 |
运行 docker-compose up 给出了上面的输出,但是当我尝试在浏览器上连接到服务器时,我什么也没得到:
The server at 172.18.0.2 is taking too long to respond.
Firefox can’t establish a connection to the server at localhost:3000.
我输入了端口和地址:
http://172.18.0.2:3000/
http://localhost:3000/
我没有收到任何错误消息。我正在使用我用 npx create-react-app docker-app 创建的样板项目。
有什么不对。
这是我的码头文件:
version: '3'
services:
web:
build:
context: .
dockerfile: Dockerfile.dev
ports:
- "3000:3000"
stdin_open: true
tty: true
volumes:
- /app/node_modules
- .:/app
Dockerfile.dev:
FROM node:11.10.1-alpine
WORKDIR '/app'
COPY package.json .
RUN npm install
COPY . .
CMD ["npm", "run", "start"]