abiosoft / abiosoft/caddy-docker

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

オープン
#57 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Shell
スター
787
フォーク
303
PR マージ指標
30日以内にマージされた PR はありません

説明

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"]
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。