I'm new ro Docker, i'm trying to dockerize my react application - This is my Dockerfile :
FROM mhart/alpine-node:latest AS builder
WORKDIR /app
COPY . .
RUN npm install formik
RUN npm install axios
RUN yarn run build
FROM mhart/alpine-node
RUN yarn global add serve
WORKDIR /app
COPY --from=builder /app/build .
EXPOSE 8000
CMD ["serve", "-p", "80", "-s", "."]
docker build -t frontend .
docker run 8000:80 frontend
localhost:8080
I get connection refused. I don't know what i did wrong, Any help is appreciated.
您应该使用参数-p
向前转发,例如:
docker run -p 8000:80 frontend
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.