Skip to content

Commit

Permalink
Create home directory in docker images
Browse files Browse the repository at this point in the history
The recent change to use `useradd -M` in baseos and ccenv
Docker images caused building of Go chaincodes to fail with error:

"failed to initialize build cache at /home/chaincode/.cache/go-build: mkdir /home/chaincode: permission denied"

Changing it back to allow creation of the chaincode home directory
with `useradd -m` solves the problem.

Signed-off-by: David Enyeart <enyeart@us.ibm.com>
  • Loading branch information
denyeart authored and satota2 committed Sep 18, 2024
1 parent ae7cb6f commit c069c69
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion images/baseos/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ RUN apt update && apt install -y \
tzdata

RUN groupadd --gid 500 chaincode
RUN useradd -c "" -u 500 -g 500 -d /home/chaincode -M chaincode
RUN useradd -c "" -u 500 -g 500 -d /home/chaincode -m chaincode

USER chaincode
2 changes: 1 addition & 1 deletion images/ccenv/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ RUN curl -sL https://go.dev/dl/go${GO_VER}.${TARGETOS}-${TARGETARCH}.tar.gz | ta
ENV PATH="/usr/local/go/bin:$PATH"

RUN groupadd --gid 500 chaincode
RUN useradd -c "" -u 500 -g 500 -d /home/chaincode -M chaincode
RUN useradd -c "" -u 500 -g 500 -d /home/chaincode -m chaincode

RUN mkdir -p /chaincode/output /chaincode/input
RUN chown -R chaincode:chaincode /chaincode
Expand Down

0 comments on commit c069c69

Please sign in to comment.