我正在尝试使用 docker 运行逆火,但出现 x509 错误:
$ docker run -it --rm \
-e BLACKFIRE_CLIENT_ID=$BLACKFIRE_CLIENT_ID \
-e BLACKFIRE_CLIENT_TOKEN=$BLACKFIRE_CLIENT_TOKEN \
blackfire/blackfire blackfire \
--slot=7 --samples=10 \
curl http://symfony.com/
错误:
Unable to verify certificate because of Unknown Authority, fallbacking on embedded Certificate Authorities.
Error sending request to Blackfire API: Get https://blackfire.io/api/v1/collab-tokens: x509: certificate signed by unknown authority
Error retrieving reference profiles: Cannot send an HTTP request to the Blackfire API.
一种解决方案是使用以下 Dockerfile 构建 blackfire/blackfire 的本地映像吗
FROM alpine:latest
RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/*
COPY BCPSG.pem /etc/ssl/certs
RUN update-ca-certificates 2>/dev/null
FROM blackfire/blackfire
ENV BLACKFIRE_CONFIG /dev/null
ENV BLACKFIRE_LOG_LEVEL 1
ENV BLACKFIRE_SOCKET tcp://0.0.0.0:8707
RUN mkdir -p /var/run/blackfire
EXPOSE 8707
RUN apk add --no-cache curl
ADD blackfire blackfire-agent /usr/bin
CMD ["blackfire-agent"]
请注意,两个 FROM 都在同一个 Dockerfile 中。但,
$docker build -t blackfire/blackfire .
给我错误:
Step 12/13 : ADD blackfire blackfire-agent /usr/bin
ADD failed: stat /var/lib/docker/tmp/docker-builder392805777/blackfire: no such file or directory
我正在构建本地 Blackfire 映像的原因是添加证书,以便 Blackfire-agent 能够与 Blackfire SaaS 服务通信,并且不会因 x509 错误而失败。
尝试过@mihal 解决方案:
$ docker build -t blackfire/blackfire .
Sending build context to Docker daemon 7.68kB
Step 1/12 : FROM blackfire/blackfire
latest: Pulling from blackfire/blackfire
8e402f1a9c57: Pull complete
8244547729ec: Pull complete
ddd7f503c29b: Pull complete
Digest: sha256:efb4966f8d23759119fcd74040a16b5197a4ff1ba52b87a540b2eb765d3cc72b
Status: Downloaded newer image for blackfire/blackfire:latest
---> 7a7965c92939
Step 2/12 : RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/*
---> Running in b9907f44f2a5
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/community/x86_64/APKINDEX.tar.gz
v3.9.2-48-g471cf80f4f [http://dl-cdn.alpinelinux.org/alpine/v3.9/main]
v3.9.2-49-g87ea954c9b [http://dl-cdn.alpinelinux.org/alpine/v3.9/community]
OK: 9759 distinct packages available
OK: 7 MiB in 19 packages
Removing intermediate container b9907f44f2a5
---> 812e166dbda7
Step 3/12 : COPY BCPSG.pem /etc/ssl/certs
---> fe8246febc72
Step 4/12 : RUN update-ca-certificates 2>/dev/null
---> Running in 58eb7726b653
Removing intermediate container 58eb7726b653
---> 0dafb5dea0be
Step 5/12 : ENV BLACKFIRE_CONFIG /dev/null
---> Running in d7fd082168c0
Removing intermediate container d7fd082168c0
---> b5a6c49e0856
Step 6/12 : ENV BLACKFIRE_LOG_LEVEL 1
---> Running in 82d8017afad6
Removing intermediate container 82d8017afad6
---> 897d2d602633
Step 7/12 : ENV BLACKFIRE_SOCKET tcp://0.0.0.0:8707
---> Running in 0ca41e881a1a
Removing intermediate container 0ca41e881a1a
---> 65a43d10ea8c
Step 8/12 : RUN mkdir -p /var/run/blackfire
---> Running in 7a7f0fe60538
Removing intermediate container 7a7f0fe60538
---> af5e1266099c
Step 9/12 : EXPOSE 8707
---> Running in 2336bab0f174
Removing intermediate container 2336bab0f174
---> 2ae826054fca
Step 10/12 : RUN apk add --no-cache curl
---> Running in 044e9a932299
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/community/x86_64/APKINDEX.tar.gz
OK: 7 MiB in 19 packages
Removing intermediate container 044e9a932299
---> 9c5a9bcef470
Step 11/12 : ADD blackfire blackfire-agent /usr/bin
ADD failed: stat /var/lib/docker/tmp/docker-builder620641237/blackfire: no such file or directory