在Docker中创build一个ng-cli容器不工作

我正在与angular2和docker工人,并试图build立一个形象。 当我进入“docker build -t angular-client:dev”。 一切似乎工作,但是当我运行angular客户端来尝试创build一个容器,它开始,而不是停止。 请有人帮我解决这个问题…..

**My 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"] **My package.Json** { "name": "angular-client", "version": "0.0.0", "license": "MIT", "angular-cli": {}, "scripts": { "start": "ng serve --host 0.0.0.0", "lint": "tslint \"src/**/*.ts\"", "test": "ng test", "pree2e": "webdriver-manager update", "e2e": "protractor" }, "private": true, "dependencies": { "@angular/common": "~2.1.0", "@angular/compiler": "~2.1.0", "@angular/core": "~2.1.0", "@angular/forms": "~2.1.0", "@angular/http": "~2.1.0", "@angular/platform-browser": "~2.1.0", "@angular/platform-browser-dynamic": "~2.1.0", "@angular/router": "~3.1.0", "core-js": "^2.4.1", "rxjs": "5.0.0-beta.12", "ts-helpers": "^1.1.1", "zone.js": "^0.6.23" }, "devDependencies": { "@types/jasmine": "^2.2.30", "@types/node": "^6.0.42", "codelyzer": "1.0.0-beta.1", "jasmine-core": "2.4.1", "jasmine-spec-reporter": "2.5.0", "karma": "1.2.0", "karma-chrome-launcher": "^2.0.0", "karma-cli": "^1.0.1", "karma-jasmine": "^1.0.2", "karma-remap-istanbul": "^0.2.1", "protractor": "4.0.9", "ts-node": "1.2.1", "tslint": "3.13.0", "typescript": "~2.0.3", "webdriver-manager": "10.2.5" } } **The output coming from kitematic** npm info lifecycle angular-client@0.0.0~start: Failed to exec start script npm ERR! Linux 4.4.59-boot2docker npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start" npm ERR! node v6.10.2 npm ERR! npm v3.10.10 npm ERR! file sh npm ERR! code ELIFECYCLE npm ERR! errno ENOENT npm ERR! syscall spawn npm ERR! angular-client@0.0.0 start: `ng serve --host 0.0.0.0` npm ERR! spawn ENOENT npm ERR! npm ERR! Failed at the angular-client@0.0.0 start script 'ng serve --host 0.0.0.0'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the angular-client package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! ng serve --host 0.0.0.0 npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs angular-client npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls angular-client npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request: npm ERR! /usr/src/app/npm-debug.log 

Angular CLI的开发依赖项缺失。 我不确定这是唯一的问题,但它会导致你得到的ng服务错误。

您的“npm start”命令失败。 检查输出来自kitematic ,那里的错误日志可能会导致你的问题