Home > Mobile >  Error building hyper ledger fabric docker image
Error building hyper ledger fabric docker image

Time:09-23

I am trying to build a hyper ledger fabric image, because here https://hyperledger-fabric.readthedocs.io/en/release-2.2/hsm.html they say: "The prebuilt Hyperledger Fabric Docker images are not enabled to use PKCS11. If you are deploying Fabric using docker, you need to build your own images and enable PKCS11 using the following command: make docker GO_TAGS=pkcs11" There's no more information about it, so I supposed I had to get the docker file of an image and build it, i found the docker files here: https://github.com/hyperledger/fabric/blob/main/images/orderer/Dockerfile

First, I tried to build it without any modifications or custom paremeters to see if it works, but it doesnt, it shows:

docker build -t myimagehlf .
Sending build context to Docker daemon  3.072kB
Step 1/22 : ARG GO_VER
Step 2/22 : ARG ALPINE_VER
Step 3/22 : FROM alpine:${ALPINE_VER} as base
invalid reference format

I think the error is on this line 'RUN apk add --no-cache tzdata', which is the fourth line of the docke file, but i have no idea why that's happening or how to fix it. I think the docker file from them should work so maybe I am doing the processs all wrong and there is another way to build "my own images". Thanks for any ideas.

CodePudding user response:

I think the intent here is to use git to clone the Fabric GitHub repository, then in your local copy of the repository (using the appropriate branch for the version of Fabric you are trying to build), to run the make docker GO_TAGS=pkcs11 command. This target in the Fabric project's Makefile will build the Docker images.

CodePudding user response:

You need to specify the tag of the alpine image which is defined by variable ${ALPINE_VER} See all available tags: https://hub.docker.com/_/alpine/tags

ARG ALPINE_VER=3.15 which will pull alpine:3.15

I runned first line build

docker build -t test-image:0.1 --file Dockerfile .
[ ] Building 23.5s (7/7) FINISHED
 => [internal] load build definition from Dockerfile                       0.2s
 => => transferring dockerfile: 225B                                       0.1s
 => [internal] load .dockerignore                                          0.2s
 => => transferring context: 2B                                            0.0s
 => [internal] load metadata for docker.io/library/alpine:3.15             5.4s
 => [auth] library/alpine:pull token for registry-1.docker.io              0.0s
 => [1/2] FROM docker.io/library/alpine:3.15@sha256:69463fdff1f025c908939  0.4s
 => => resolve docker.io/library/alpine:3.15@sha256:69463fdff1f025c908939  0.1s
 => => sha256:69463fdff1f025c908939e86d4714b4d5518776954c 1.64kB / 1.64kB  0.0s
 => => sha256:7a38a4540724813e4190d086e955a8e757a7302551cc755 528B / 528B  0.0s
 => => sha256:c4fc938168588a0ba6178945c3d9047f27101eb3a42 1.47kB / 1.47kB  0.0s
 => [2/2] RUN apk add --no-cache tzdata                                   13.4s
 => exporting to image                                                     2.3s
 => => exporting layers                                                    2.2s
 => => writing image sha256:b707cc6dede25411607070e7560bd576a492c41ba9e88  0.0s
 => => naming to docker.io/library/test-image:0.1                          0.0s
  • Related