abiosoft / abiosoft/caddy-docker

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

Abierto
#57 5 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Shell
Estrellas
787
Forks
303
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.