0

I am trying to create an image based on this dockerfile:

https://github.com/99designs/aws-vault/blob/master/Dockerfile

Here are the 3 steps I followed:

git clone https://github.com/99designs/aws-vault.git

cd aws-vault/

docker build . --disable-content-trust  -t shantanuo/pm

Got this error:

The command '/bin/sh -c go build -a -tags netgo -ldflags '-w' -o /bin/aws-vault' returned a non-zero code: 1

Not sure if this issue is related to go language or docker though!

shantanuo
  • 31,689
  • 78
  • 245
  • 403
  • Possible duplicate of [The command '/bin/sh returned a non-zero code: 1](https://stackoverflow.com/questions/43179863/the-command-bin-sh-returned-a-non-zero-code-1) – TheCoder Oct 08 '19 at 07:53

1 Answers1

1

you need to install all the required libraries at first , you can find them from the error trace.

use this :

FROM golang:1.9.2 AS build-env

ENV CGO_ENABLED=0 \
    GOOS=linux \
    GOARCH=amd64

WORKDIR /go/src/github.com/99designs/aws-vault
ADD . /go/src/github.com/99designs/aws-vault
RUN go get github.com/99designs/keyring \
    github.com/aws/aws-sdk-go/aws \
    github.com/aws/aws-sdk-go/aws/awserr \
    github.com/aws/aws-sdk-go/aws/credentials \
    github.com/aws/aws-sdk-go/aws/session \
    github.com/aws/aws-sdk-go/service/iam \
    github.com/aws/aws-sdk-go/service/sts \
    github.com/mitchellh/go-homedir \
    github.com/skratchdot/open-golang/open \
    golang.org/x/crypto/ssh/terminal \
    gopkg.in/alecthomas/kingpin.v2 \
    gopkg.in/ini.v1
RUN go build -a -tags netgo -ldflags '-w' -o /bin/aws-vault

FROM alpine
COPY --from=build-env /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=build-env /bin/aws-vault /aws-vault
ENTRYPOINT ["/aws-vault"]
LinPy
  • 16,987
  • 4
  • 43
  • 57