在Docker容器代码中使用Gulp命令139

我有这个docker-compose文件:

rest-api: image: x/rest-api build: context: ./rest-api/dockerfiles/ dockerfile: local.Dockerfile environment: - BUILD_ENV=local ports: - "8001:8001" volumes: - ./rest-api:/var/www/rest-api user: $UID web: image: x/web-front build: context: ./web-front dockerfile: dockerfiles/local.Dockerfile environment: - BUILD_ENV=local depends_on: - rest-api links: - rest-api ports: - "3001:3001" - "35729:35729" volumes: - ./web-front:/var/www/web-front - ./web-front/logs/:/root/.npm/ user: $UID 

和这2个local.dockerfile。 REST的API:

  FROM node:8-alpine RUN mkdir -p /var/www/rest-api/ WORKDIR /var/www/rest-api/ EXPOSE 8001 CMD [ "npm", "run", "dev" ] 

Web的前端:

  FROM node:8-alpine RUN mkdir -p /var/www/web-front/ WORKDIR /var/www/web-front/ EXPOSE 3001 35729 CMD [ "npm", "run", "local" ] 

我基本上从主机安装我所有的node_modules,然后将卷映射到容器中相应的文件夹,以实现rest-api和web-front。 然后我从容器中运行我的package.json中的命令。 我没有遇到其余的api问题。 在networking前面的想法,该过程退出与分段错误(核心转储)和错误代码139

 CMD [ "npm", "run", "local" ] 

运行:

 "NODE_ENV=local ./node_modules/gulp/bin/gulp.js dev --location=local --env=dev --livereload=1", 

当我运行npm run local直接在npm run local计算机上npm run local ,我无法解决这个问题。 我已经试过npm rebuild没有成功的节点版本在容器上是一样的主机上。 我有这个debugging:

  0 info it worked if it ends with ok 1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'local' ] 2 info using npm@5.0.0 3 info using node@v8.0.0 4 verbose run-script [ 'prelocal', 'local', 'postlocal' ] 5 info lifecycle web-front@0.5.0~prelocal: web-front@0.5.0 6 silly lifecycle web-front@0.5.0~prelocal: no script for prelocal, continuing 7 info lifecycle web-front@0.5.0~local: web-front@0.5.0 8 verbose lifecycle web-front@0.5.0~local: unsafe-perm in lifecycle true 9 verbose lifecycle web-front@0.5.0~local: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/var/www/web-front/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 10 verbose lifecycle web-front@0.5.0~local: CWD: /var/www/web-front 11 silly lifecycle web-front@0.5.0~local: Args: [ '-c', 11 silly lifecycle 'NODE_ENV=local ./node_modules/gulp/bin/gulp.js dev --location=local --env=dev --livereload=1' ] 12 silly lifecycle web-front@0.5.0~local: Returned: code: 139 signal: null 13 info lifecycle web-front@0.5.0~local: Failed to exec local script 14 verbose stack Error: web-front@0.5.0 local: `NODE_ENV=local ./node_modules/gulp/bin/gulp.js dev --location=local --env=dev --livereload=1` 14 verbose stack Exit status 139 14 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:283:16) 14 verbose stack at emitTwo (events.js:125:13) 14 verbose stack at EventEmitter.emit (events.js:213:7) 14 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14) 14 verbose stack at emitTwo (events.js:125:13) 14 verbose stack at ChildProcess.emit (events.js:213:7) 14 verbose stack at maybeClose (internal/child_process.js:887:16) 14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:208:5) 15 verbose pkgid web-front@0.5.0 16 verbose cwd /var/www/web-front 17 verbose Linux 4.4.0-66-generic 18 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "local" 19 verbose node v8.0.0 20 verbose npm v5.0.0 21 error code ELIFECYCLE 22 error errno 139 23 error web-front@0.5.0 local: `NODE_ENV=local ./node_modules/gulp/bin/gulp.js dev --location=local --env=dev --livereload=1` 23 error Exit status 139 24 error Failed at the web-front@0.5.0 local script. 24 error This is probably not a problem with npm. There is likely additional logging output above. 25 verbose exit [ 139, true ] 

你有什么想法,这个错误来自哪里? 提前致谢。

这个问题是因为阿尔派。 高山使用musl而不是glibc,这导致一些图书馆的问题。 使用Debian或任何其他使用glibc的发行版。