Added Docker CLI binary to final image

pull/36/head
Quentin McGaw 5 years ago
parent dec14665e1
commit 98697c544e

@ -14,6 +14,20 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=${GOARCH} GOARM=${GOARM} go build -a -ldflag
-X main.version=${VERSION} \
-X main.buildSource=Docker"
FROM ${BASE_IMAGE_BUILDER}:${GO_VERSION}-alpine${ALPINE_VERSION} AS docker-builder
ARG GOARCH=amd64
ARG GOARM
ARG DOCKER_VERSION=v18.09.7
RUN apk add -U -q --progress --no-cache git bash coreutils gcc musl-dev
WORKDIR /go/src/github.com/docker/cli
RUN git clone --branch ${DOCKER_VERSION} --single-branch --depth 1 https://github.com/docker/cli.git . > /dev/null 2>&1
ENV CGO_ENABLED=0 \
GOARCH=${GOARCH} \
GOARM=${GOARM} \
DISABLE_WARN_OUTSIDE_CONTAINER=1
RUN ./scripts/build/binary
RUN rm build/docker && mv build/docker-linux-* build/docker
FROM scratch
ARG BUILD_DATE
ARG VCS_REF
@ -28,4 +42,5 @@ LABEL org.label-schema.schema-version="1.0.0-rc1" \
org.label-schema.version=${VERSION}
ENTRYPOINT [ "/lazydocker" ]
VOLUME [ "/.config/jesseduffield/lazydocker" ]
COPY --from=builder /go/src/github.com/jesseduffield/lazydocker/lazydocker /lazydocker
ENV PATH=/
COPY --from=docker-builder /go/src/github.com/docker/cli/build/docker /docker

@ -117,6 +117,10 @@ docker build -t lazyteam/lazydocker \
.
```
If you encounter a compatibility issue with Docker bundled binary, try rebuilding
the image with the build argument `--build-arg DOCKER_VERSION="v$(docker -v | cut -d" " -f3 | rev | cut -c 2- | rev)"`
so that the bundled docker binary matches your host docker binary version.
## Usage
Call `lazydocker` in your terminal. I personally use this a lot so I've made an alias for it like so:

Loading…
Cancel
Save