我正在嘗試通過紗線在 docker 內運行一個網路應用程式。這是碼頭檔案
FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y && apt-get upgrade -y
ENV TZ=Pacific/Auckland
RUN echo $TZ > /etc/timezone && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime
RUN apt-get install curl -y
RUN apt-get install npm -y
RUN apt-get install git -y
RUN npm cache clean -f
RUN npm install -g n
RUN n stable
RUN apt remove cmdtest -y
RUN apt remove yarn -y
RUN npm install -g yarn -y
RUN git config --global url."https://".insteadOf git://
EXPOSE 8080
COPY . .
RUN yarn
CMD yarn start
當我yarn start作為非 docker 運行時,可以通過以下方式訪問 Web 應用程式localhost:8080
但是,當我通過啟動 docker 實體并 docker run -p 8080:8080 -itd webapp:latest啟動 Web 瀏覽器并在http://localhost:8080webapp 中鍵入時無法訪問。
針對容器運行docker logs不會顯示任何錯誤。
當我運行 curl 時,這是我看到的錯誤
curl "http://localhost:8080"
curl: (56) Recv failure: Connection reset by peer
我不知道發生了什么事。請我請求幫助來解決這個問題。
uj5u.com熱心網友回復:
IP 必須系結在多個介面上才能開始作業
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/490740.html
上一篇:Angular專案構建僅在GitHubActions上失敗
下一篇:無法發布到npm
