Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install oc on alpine linux #11135

Closed
kenjones-cisco opened this issue Sep 28, 2016 · 11 comments

Comments

@kenjones-cisco
Copy link

commented Sep 28, 2016

Is there any reason that the latest version (v1.3.0) of the client tools (https://github.com/openshift/origin/releases/download/v1.3.0/openshift-origin-client-tools-v1.3.0-3ab7af3d097b57f933eccef684a714f2368804e7-linux-64bit.tar.gz) should not work on alpine linux?

Version
$ oc version
oc v1.3.0
kubernetes v1.3.0+52492b4
features: Basic-Auth

Server https://192.168.99.101:8443
openshift v1.3.0
kubernetes v1.3.0+52492b4
Steps To Reproduce
FROM alpine:3.4

ENV OPENSHIFT_VERSION v1.3.0
ENV OPENSHIFT_HASH 3ab7af3d097b57f933eccef684a714f2368804e7

RUN apk add --no-cache --virtual .build-deps \
        curl \
        tar \
    && curl --retry 7 -Lso /tmp/client-tools.tar.gz "https://github.com/openshift/origin/releases/download/${OPENSHIFT_VERSION}/openshift-origin-client-tools-${OPENSHIFT_VERSION}-${OPENSHIFT_HASH}-linux-64bit.tar.gz" \
    && tar zxf /tmp/client-tools.tar.gz --strip-components=1 -C /usr/local/bin \
    && rm /tmp/client-tools.tar.gz \
    && apk del .build-deps
  1. docker build -t docker_oc .
  2. docker run --rm docker_oc /bin/sh
  3. /usr/local/bin/oc version
Current Result
~ # /usr/local/bin/oc version
/bin/sh: /usr/local/bin/oc: not found
Expected Result
$ oc version
oc v1.3.0
kubernetes v1.3.0+52492b4
features: Basic-Auth

Server https://192.168.99.101:8443
openshift v1.3.0
kubernetes v1.3.0+52492b4
@kenjones-cisco

This comment has been minimized.

Copy link
Author

commented Sep 28, 2016

Here is what I see in the directory:

~ # ls -la /usr/local/bin/
total 94792
drwxr-xr-x    2 root     root          4096 Sep 28 12:20 .
drwxr-xr-x    7 root     root          4096 Sep 28 12:20 ..
-rw-r--r--    1 root     root         10759 Sep 16 01:11 LICENSE
-rw-r--r--    1 root     root         20497 Sep 16 01:11 README.md
-rwxr-xr-x    1 root     root      97018178 Sep 16 01:11 oc
@jawnsy

This comment has been minimized.

Copy link

commented Sep 28, 2016

@kenjones-cisco Hey Kenny,

Thanks for your bug report!

I can reproduce the problem you're seeing, though I'm unsure what the problem is - the behaviour is quite strange 😄

Even using strace inside the container isn't terribly informative.

# strace /usr/local/bin/oc2
execve("/usr/local/bin/oc2", ["/usr/local/bin/oc2"], [/* 9 vars */]) = -1 ENOENT (No such file or directory)
writev(2, [{"strace: exec: No such file or di"..., 39}, {"\n", 1}], 2strace: exec: No such file or directory
) = 40
writev(2, [{"", 0}, {NULL, 0}], 2)      = 0
getpid()                                = 48
exit_group(1)                           = ?
+++ exited with 1 +++

@jawnsy jawnsy self-assigned this Sep 28, 2016

@mrunalp

This comment has been minimized.

Copy link
Member

commented Sep 28, 2016

@jawnsy

This comment has been minimized.

Copy link

commented Sep 28, 2016

Thanks to my @mrunalp for pointing out that oc is dynamically linking to glibc. You can see this by checking ldd output:

# ldd oc
    /lib64/ld-linux-x86-64.so.2 (0x55a1fb128000)
    libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x55a1fb128000)
    libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x55a1fb128000)
    libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x55a1fb128000)
# ls -al /lib64/ld-linux-x86-64.so.2
ls: /lib64/ld-linux-x86-64.so.2: No such file or directory
# ls -al /lib64
ls: /lib64: No such file or directory

You can get around this by using the alpine-glibc image instead; changing the Dockerfile to be FROM frolvlad/alpine-glibc:latest works for me.

Now the question is, should we be building our binaries as completely static, instead of relying on glibc to be available? Seems like a question for @smarterclayton

Jonathan

@kenjones-cisco

This comment has been minimized.

Copy link
Author

commented Sep 28, 2016

statically linked 👍

Thanks for the response on a workaround!

@smarterclayton

This comment has been minimized.

Copy link
Member

commented Sep 28, 2016

There are some concerns about it - DNS behavior is different, and it may
lead to less debuggable issues. Will discuss with the build teams and look
at something that will still be allowed in distros that don't do allow
compilation.

On Wed, Sep 28, 2016 at 3:21 PM, Kenny Jones notifications@github.com
wrote:

statically linked 👍

Thanks for the response on a workaround!


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#11135 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABG_p8K3Vp9rvl6ZY9IxoNPZWiuBgEamks5qur4jgaJpZM4KIypV
.

@danmcp danmcp added the priority/P2 label Sep 29, 2016

@danmcp danmcp assigned smarterclayton and unassigned jawnsy Sep 29, 2016

rschlaefli added a commit to appuio/gitlab-runner-oc that referenced this issue Mar 7, 2017

@prasenforu

This comment has been minimized.

Copy link

commented Mar 29, 2017

But using FROM frolvlad/alpine-glibc:latest

Getting following error when login

/ # oc login
Server [https://localhost:8443]: https://ose-master.cloud-cafe.in:8443
error: x509: failed to load system roots and no roots provided

@openshift-bot

This comment has been minimized.

Copy link

commented Feb 9, 2018

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@geordgez

This comment has been minimized.

Copy link

commented Mar 12, 2018

@prasenforu your issue is actually related to ca-certificates (see a similar question for goji, which links to the original Docker issue). It should work if you add this to your Dockerfile:

RUN apk add --update ca-certificates

In case it helps, this is the Dockerfile (Dockerfile-oc-origin-issue11135) I used:

FROM frolvlad/alpine-glibc:latest

RUN apk add --no-cache --virtual .build-deps \
        curl \
        tar \
    && curl --retry 7 -Lo /tmp/client-tools.tar.gz "https://mirror.openshift.com/pub/openshift-v3/clients/3.7.23/linux/oc.tar.gz"

RUN tar zxf /tmp/client-tools.tar.gz -C /usr/local/bin oc \
    && rm /tmp/client-tools.tar.gz \
    && apk del .build-deps

# ADDED: Resolve issue x509 oc login issue
RUN apk add --update ca-certificates

It's slightly different from the suggestions above but I ran into the same issues as you when I omitted the last line.

Commands:

$ docker build -f Dockerfile-oc-origin-issue11135 --rm -t docker_oc .
$ docker run -it --rm docker_oc /bin/sh
$ oc login

Docker version

Client:
 Version:	17.12.0-ce
 API version:	1.35
 Go version:	go1.9.2
 Git commit:	c97c6d6
 Built:	Wed Dec 27 20:03:51 2017
 OS/Arch:	darwin/amd64

Server:
 Engine:
  Version:	17.12.0-ce
  API version:	1.35 (minimum version 1.12)
  Go version:	go1.9.2
  Git commit:	c97c6d6
  Built:	Wed Dec 27 20:12:29 2017
  OS/Arch:	linux/amd64
  Experimental:	true
@openshift-bot

This comment has been minimized.

Copy link

commented Apr 11, 2018

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

@openshift-bot

This comment has been minimized.

Copy link

commented May 11, 2018

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
9 participants
You can’t perform that action at this time.