Py学习  »  docker

用户应该有哪些权限公开docker容器端口?

Road2PreSchool • 5 年前 • 1471 次点击  

https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-on-alpine .

Error: listen EACCES 0.0.0.0:80 .

找不到有关应添加到此用户的权限的清晰文档,因此用户可以公开$PORT

尝试在开始使用新用户之前公开端口,但也失败。

停靠文件

FROM node

# Installs latest Chromium (72) package.
RUN apk update && apk upgrade && \
    echo @edge http://nl.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories && \
    echo @edge http://nl.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories && \
    apk add --no-cache \
      chromium@edge \
      nss@edge \
      freetype@edge \
      harfbuzz@edge \
      ttf-freefont@edge \
      udev

RUN mkdir -p /app
WORKDIR /app

# Tell Puppeteer to skip installing Chrome. We'll be using the installed package.
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true

# Add user so we don't need --no-sandbox.
RUN addgroup -S pptruser && adduser -S -g pptruser pptruser \
    && mkdir -p /home/pptruser/Downloads \
    && chown -R pptruser:pptruser /home/pptruser \
    && chown -R pptruser:pptruser /app


ENV PORT 80
ENV HTTP_PORT $PORT
ENV HTTPS_PORT 443

EXPOSE $HTTP_PORT
EXPOSE $HTTPS_PORT

USER pptruser


CMD [ "run.sh" ]

运行.sh

#!/bin/sh

PORT="${HTTP_PORT:-80}"

node "app/bin/server.js"

日志错误

 Error: listen EACCES 0.0.0.0:80
at Object.exports._errnoException (util.js:1020:11)
at exports._exceptionWithHostPort (util.js:1043:20)
at Server._listen2 (net.js:1258:19)
at listen (net.js:1307:10)
at Server.listen (net.js:1403:5)
at appServer.app.then.then.then (/app/bin/server.js:69:12)

感谢任何帮助

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/54369
 
1471 次点击  
文章 [ 1 ]  |  最新文章 5 年前