execSync在Docker容器中挂起但在本地按预期工作

时间:2018-04-04 17:03:05

标签: javascript node.js docker curl child-process

我正在尝试使用execSync从我的Node代码中卷曲端点(因为我需要同步执行),它返回大约90KB的有效负载。这在本地完全正常,但在Docker容器中,以下行挂起:

const { execSync } = require('child_process');

return execSync(
    `curl -X DELETE "https://foo.com"`
);

这也是我的Dockerfile设置:

# Base image to match prod node version (deploy-swarm: 6.9.4) (Jenkins2: 4.2.6)
FROM node:6.9.4-alpine

# Make the working directory folder
WORKDIR /cloudinary-batch-jobs

# Install dependencies with npm
COPY *.npmrc package.json package-lock.json /tmp/
RUN cd /tmp && /usr/local/bin/npm install --production
RUN mv /tmp/node_modules /cloudinary-batch-jobs

# Copy all files into working directory
COPY . /cloudinary-batch-jobs

# Get curl
RUN apk --update --no-cache add curl

CMD node /cloudinary-batch-jobs/index.js

0 个答案:

没有答案