docker 运行 -p 3000:3000 d9a82c31eab5 不工作
docker run -p 3000:3000 d9a82c31eab5 not working
docker run -p 3000:3000 d9a82c31eab5
docker-app start /app
react-scripts start
wds: Project is running at http://172.17.0.2/ wds: webpack output is served from wds: Content not from webpack is served from /app/public wds: 404s will fallback to / Starting the development server...
在 172.17.0.2:3000 上查看,没有任何内容。有什么我忘了做的事吗?我在使用 npx create-react-app docker-app 创建的新项目上使用 docker。
我使用 Dockerfile 来创建项目:
FROM node:alpine
WORKDIR '/app'
COPY package.json .
RUN npm install
COPY . .
CMD ["npm", "run", "start"]
它没有抛出错误或任何东西,但我在浏览器上:
The connection has timed out
The server at 172.17.0.2 is taking too long to respond.
services:
client:
build: ./client
volumes:
- /app/node_modules
- ./client/src:/app/src
ports:
- 3000:3000
stdin_open: true
tty: true
backend:
build: ./backend
env_file: ./.env/backend
ports:
- 5000:5000
- 5001:5001
将 stdin_open 和 tty 设置为 true,解决了问题。
docker run -p 3000:3000 d9a82c31eab5
docker-app start /app
react-scripts start
wds: Project is running at http://172.17.0.2/ wds: webpack output is served from wds: Content not from webpack is served from /app/public wds: 404s will fallback to / Starting the development server...
在 172.17.0.2:3000 上查看,没有任何内容。有什么我忘了做的事吗?我在使用 npx create-react-app docker-app 创建的新项目上使用 docker。
我使用 Dockerfile 来创建项目:
FROM node:alpine
WORKDIR '/app'
COPY package.json .
RUN npm install
COPY . .
CMD ["npm", "run", "start"]
它没有抛出错误或任何东西,但我在浏览器上:
The connection has timed out
The server at 172.17.0.2 is taking too long to respond.
services:
client:
build: ./client
volumes:
- /app/node_modules
- ./client/src:/app/src
ports:
- 3000:3000
stdin_open: true
tty: true
backend:
build: ./backend
env_file: ./.env/backend
ports:
- 5000:5000
- 5001:5001
将 stdin_open 和 tty 设置为 true,解决了问题。