abiosoft / abiosoft/caddy-docker

php - Uncaught Exception: Could not gather sufficient random data in Command line

Đang mở
#57 5 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Shell
Star
787
Fork
303
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

PHP v7.0.16 has a bug that throws this error under certain conditions: https://github.com/docker-library/php/issues/376

I run into this error on my debian-based server:

```
ckeeney@staging $ cat /etc/issue
Debian GNU/Linux 8 \n \l
```

```
ckeeney@staging $ docker run --entrypoint=php abiosoft/caddy:php "-r random_int(0,1);"
PHP Fatal error: Uncaught Exception: Could not gather sufficient random data in Command line code:1
Stack trace:
#0 Command line code(1): random_int(0, 1)
#1 {main}
thrown in Command line code on line 1
```

I don't experience this problem on my Ubuntu-based laptop.

For quite a while, I've been thinking the php tag might be better built as `FROM php:alpine`. Installing Caddy is easy, it's just an executable. The way it is currently built restricts us to using exactly the version of PHP made available through the alpine repos.

When I built a container for Caddy with nodejs similar to the `abiosoft/caddy:php` image, I started from `node:alpine` and added Caddy. My nodejs + caddy Dockerfile looks something like this:

```Dockerfile
FROM node:7.2-alpine
RUN apk add --no-cache ack git curl
RUN npm install -g --progress=false \
create-react-app serve yarn

# install caddy
ARG plugins=http.git
RUN curl --silent --show-error --fail --location \
--header "Accept: application/tar+gzip, application/x-gzip, application/octet-stream" -o - \
"https://caddyserver.com/download/linux/amd64?plugins=${plugins}" \
| tar --no-same-owner -C /usr/bin/ -xz caddy \
&& chmod 0755 /usr/bin/caddy \
&& /usr/bin/caddy -version

WORKDIR /srv
COPY ./package.json /srv/package.json
COPY ./yarn.lock /srv/yarn.lock
RUN yarn
COPY . /srv
RUN yarn build
COPY ./Caddyfile /etc/Caddyfile
VOLUME /srv
EXPOSE 80
ENTRYPOINT ["/usr/bin/caddy"]
CMD ["--conf", "/etc/Caddyfile", "--log", "stdout"]
```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.