:启动容器进程导致" exec:\" sudo \":找不到可执行文件

时间:2017-06-20 16:13:23

标签: docker docker-compose

错误:无法启动服务cpanel_client:无效的头字段值" oci运行时错误:container_linux.go:247:启动容器进程导致" exec:\" sudo \":找不到可执行文件

这是我的泊坞文件

FROM node:8.1.2-alpine

WORKDIR /control-panel
COPY package.json /control-panel/package.json
RUN npm install auth0-lock mapbox-gl mapbox-gl-geocoder tinymce angular2-jwt aws-sdk @angular/cli hammerjs jquery moment moment-timezone bootstrap@3 jquery-ui-dist --save
RUN mv /control-panel/node_modules /node_modules
COPY . /control-panel
EXPOSE 4200
EXPOSE 49153

这是docker compose.yml,

cpanel_client:
    build: .
    ports:
        - "4200:4200"
        - "49153:49153"
    volumes:
        - .:/control-panel
    command: npm start

我的package.json文件,

{
  "name": "cpanelcli",
  "version": "0.0.0",
  "license": "MIT",
  "angular-cli": {},
  "scripts": {
    "ng": "ng",
    "start": "ng serve --host 0.0.0.0",
    "lint": "tslint \"src/**/*.ts\"",
    "test": "ng test",
    "pree2e": "webdriver-manager update --standalone false --gecko false",
    "e2e": "protractor"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "4.0.0",
    "@angular/compiler": "4.0.0",
    "@angular/core": "4.0.0",
    "@angular/forms": "4.0.0",
    "@angular/http": "4.0.0",
    "@angular/material": "^2.0.0-beta.2",
    "@angular/platform-browser": "4.0.0",
    "@angular/platform-browser-dynamic": "4.0.0",
    "@angular/router": "^3.3.1",
    "@types/jquery": "^2.0.46",
    "angular2-jwt": "^0.1.28",
    "aws-sdk": "^2.28.0",
    "bootstrap": "^3.3.7",
    "core-js": "^2.4.1",
    "hammerjs": "^2.0.8",
    "jquery": "^3.2.1",
    "jquery-ui-dist": "^1.12.1",
    "mapbox-gl": "^0.34.0",
    "mapbox-gl-geocoder": "^2.0.1",
    "mapbox.js": "^3.0.1",
    "ng2-datepicker": "^1.8.0",
    "rxjs": "^5.0.1",
    "tinymce": "^4.5.5",
    "ts-helpers": "^1.1.1",
    "zone.js": "^0.7.2"
  },
  "devDependencies": {
    "@angular/compiler-cli": "^2.3.1",
    "@types/jasmine": "2.5.38",
    "@types/node": "^6.0.42",
    "angular-cli": "1.0.0-beta.24",
    "codelyzer": "~2.0.0-beta.1",
    "jasmine-core": "2.5.2",
    "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.13",
    "ts-node": "1.2.1",
    "tslint": "^4.0.2",
    "typescript": "~2.0.3"
  }
}

构建成功。当我运行docker-compose run –rm cpanel_client ng init –skip-npm –name CliDemo时,我得到了这个错误。  谁能告诉我哪里错了?

2 个答案:

答案 0 :(得分:1)

图片上未显示sudo。请注意错误消息:

"exec: \"sudo\": executable file not found

某事正试图sudo(“超级用户做”)一件事,而不是。尝试通过程序包管理器安装sudo以安抚该步骤,或尝试将该步骤配置为不需要超级用户权限。

答案 1 :(得分:1)

node_modules/.bin文件夹默认不在$PATH。您需要直接调用路径:

command: /control-panel/node_modules/.bin/ng serve --host 0.0.0.0