1
我們正試圖建立一個角2應用與碼頭工人按照本教程:https://scotch.io/tutorials/create-a-mean-app-with-angular-2-and-docker-compose泊塢窗與角2:無法獲取
程序部署,但我們得到「不能得到/」
這是怎麼了我們建立我們的應用程序:
sudo docker build -t frontend:dev .
,這是我們如何運行我們的應用程序
sudo docker run -d --name frontend -p 1014:4200 frontend:dev
我們dockerfile是完全一樣的教程:
# Create image based on the official Node 6 image from dockerhub
FROM node:6
# Create a directory where our app will be placed
RUN mkdir -p /usr/src/app
# Change directory so that our commands run inside this new directory
WORKDIR /usr/src/app
# Copy dependency definitions
COPY package.json /usr/src/app
# Install dependecies
RUN npm install
# Get all the code needed to run the app
COPY . /usr/src/app
# Expose the port the app runs in
EXPOSE 4200
# Serve the app
CMD ["npm", "start"]
這是從的package.json摘錄
{
"name": "courseka",
"version": "0.0.0",
"scripts": {
"start": "ng serve -H 0.0.0.0"
"build": "ng build"
}
}
而在去年,從我們的index.html文件的東西
<html>
<head>
<base href="/">
</head>
</html>
跟蹤會有很大幫助檢測。但'不能GET /'看起來像是錯過了HTTP呼叫。因此,您沒有正確的' ',或者您沒有正確設置服務器 –
trichetriche
您是否檢查了docker日誌?你的服務器運行正常嗎? – Amriteya