首先,我对docker的了解有限。这是我的问题:我无法在已部署的容器中运行操纵up。我对服务端点提出的请求最终超时了。
我尝试将以下https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker添加到我的dockerfile中,以使其正常运行。我尝试了多种变体,但是基于反复试验,因为我对任何事物的实际运作方式都不了解。
这是当前的Dockerfile
FROM node:8.9.4
RUN apt-get update && \
apt-get install -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \
libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \
libxcursor1 libxdamage1 libxext6 libxfixesx3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst ttf-freefont \
ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget && \
wget https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64.deb && \
dpkg -i dumb-init_*.deb && rm -f dumb-init_*.deb && \
apt-get clean && apt-get autoremove -y && rm -rf /var/lib/apt/lists/*
RUN mkdir -p /opt/app
COPY . /opt/app
RUN groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser
ENV LANG="C.UTF-8"
WORKDIR /opt/app
RUN cd /opt/app
RUN \
npm install -g typescript && \
npm install pm2 -g -y
RUN npm i \
npm i puppeteer \
# Add user so we don't need --no-sandbox.
# same layer as npm install to keep re-chowned files from using up several hundred MBs more space
&& mkdir -p /home/pptruser/Downloads \
&& chown -R pptruser:pptruser /home/pptruser \
&& chown -R pptruser:pptruser /opt/app/node_modules
RUN npm run build
USER pptruser
ENTRYPOINT ["dumb-init", "--"]
EXPOSE 3600
CMD ["pm2-runtime", "pm2.json", "google-chrome-unstable" ]
服务应使用puppeteer生成一些html并生成图像文件。有没有人可以帮助我?