i am trying to run backfire using docker , but getting x509 error:
$ 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/
Error:
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.
Could one solution be to build a local image of blackfire/blackfire using the following Dockerfile
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"]
notice that both the FROM are in the same Dockerfile. but,
$docker build -t blackfire/blackfire .
gives me error:
Step 12/13 : ADD blackfire blackfire-agent /usr/bin
ADD failed: stat /var/lib/docker/tmp/docker-builder392805777/blackfire: no such file or directory
The reason, I am building a local Blackfire image, is to add the certificate, so that the Blackfire-agent will be able to communicate with the Blackfire SaaS Service and not fail with x509 error.
tried @mihal solution:
$ 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
You can have 2 FROM statements if you have a multi-stage build but then you should name the first one and do something with it in the second one. Which doesn't seem to be your case.
Can you try this version:
FROM blackfire/blackfire
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
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"]