Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Json 角度为2的Docker:无法获取_Json_Angular_Docker - Fatal编程技术网

Json 角度为2的Docker:无法获取

Json 角度为2的Docker:无法获取,json,angular,docker,Json,Angular,Docker,按照本教程,我们正在尝试使用Docker设置Angular 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 Nod

按照本教程,我们正在尝试使用Docker设置Angular 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>

问题似乎是Linux和Windows的问题。该应用程序的开发发生在Windows上,其中导入文件夹和类不区分大小写,而在Linux上则不区分大小写,两个导入的大小写错误

通过使用运行来检测问题

-it

参数,该参数记录所有输出

似乎问题出在Linux Windows上。该应用程序的开发发生在Windows上,其中导入文件夹和类不区分大小写,而在Linux上则不区分大小写,两个导入的大小写错误

通过使用运行来检测问题

-it

参数,记录所有输出

跟踪将非常有用。但是,
无法获取/
看起来像是错过了HTTP调用。那么,您的服务器是否没有正确的
,或者您没有正确设置服务器?您是否检查了docker日志?你的服务器运行正常吗?跟踪会有很大帮助。但是,
无法获取/
看起来像是错过了HTTP调用。那么,您的服务器是否没有正确的
,或者您没有正确设置服务器?您是否检查了docker日志?你的服务器运行正常吗?你能解释你的答案吗?你能解释你的答案吗?