How to install docker-compose in jenkinsci/blueocean?
Asked Answered
C

2

8

The docker image jenkinsci/blueocean seems official since the official document is mentioning the image.

I want to run docker-compose command in the container but this image only comes with docker but not docker-compose.

Thus, I tried to install docker-compose as the usual way inside the container.

$ curl -L https://github.com/docker/compose/releases/download/1.21.0/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
$ chmod +x /usr/local/bin/docker-compose

It looked installed successfully, however, when I run docker-compose --version, it returns bash: ./docker-compose: No such file or directory, even though I can see the docker-compose executable at $(which docker-compose).

(This error is not relative with $PATH, I tried to run directly at the directory where docker-compose is located)

How could I install docker-compose in the image, that is, how can I build new image containing docker-compose based on jenkinsci/blueocean?

Cornie answered 28/4, 2018 at 8:24 Comment(3)
Are you trying to run docker-compose as part of a job?Ruel
@Cornie I am trying to do the same thing and am having the same issue as you. Did you ever solve this problem?Apus
@jminardi, No I am just planning to try installing Jenkins over Ubuntu image including docker-compose.Cornie
W
4

For me worked solution from "INSTALL AS A CONTAINER" which is:

$ sudo curl -L --fail https://github.com/docker/compose/releases/download/1.21.2/run.sh -o /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose
Wayward answered 10/7, 2018 at 12:58 Comment(0)
G
3

You need to add glibc:

FROM jenkinsci/blueocean

USER root

RUN curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose && \
    chmod +x /usr/local/bin/docker-compose

RUN apk add ca-certificates wget && \
    wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub && \
    GLIBC_VERSION='2.27-r0' && \
    wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk && apk add glibc-${GLIBC_VERSION}.apk && \
    wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-bin-${GLIBC_VERSION}.apk && apk add glibc-bin-${GLIBC_VERSION}.apk
Gonadotropin answered 12/6, 2018 at 12:16 Comment(1)
With the most recent blue ocean image, I found that glibc is built in. So the last 5 lines can be omitted. And for safety wouldn't it be better to close with USER jenkins to prevent the container running as root?Hieroglyphic

© 2022 - 2024 — McMap. All rights reserved.