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

CF install-plugin fails on alpine docker container #1314

Closed
rjain-pivotal opened this issue Jan 31, 2018 · 2 comments
Closed

CF install-plugin fails on alpine docker container #1314

rjain-pivotal opened this issue Jan 31, 2018 · 2 comments
Labels

Comments

@rjain-pivotal
Copy link

Command

cf install-plugin autopilot

What occurred

fork/exec /root/.cf/plugins/temp983421633/578135707: no such file or directory
File is not a valid cf CLI plugin binary.
FAILED

What you expected to occur

cf install-plugin should have installed the plugin.

CLI Version

cf version 6.34.1+bbdf81482.2018-01-17

CC API Endpoint Version

api version: 2.94.0

CF Trace

Plugin autopilot 0.0.4 found in: CF-Community
Attention: Plugins are binaries written by potentially untrusted authors.
Install and use plugins at your own risk.
Do you want to install the plugin autopilot? [yN]: y
Starting download of plugin binary from repository CF-Community...
REQUEST: [2018-01-31T02:42:33Z]
GET /contraband/autopilot/releases/download/0.0.4/autopilot-linux HTTP/1.1
Host: github.com
Accept: application/json
Content-Type: application/json
User-Agent: cf/6.34.1+bbdf81482.2018-01-17 (go1.9.2; amd64 linux)

7.97 MiB / 7.97 MiB [==========================================================================================] 100.00% 1s
RESPONSE: [2018-01-31T02:42:35Z]
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Disposition: attachment; filename=autopilot-linux
Content-Length: 8361917
Content-Type: application/octet-stream
Date: Wed, 31 Jan 2018 02:42:35 GMT
Etag: "4840041e4b74d6b89ad2415e3afb1f9e"
Last-Modified: Thu, 14 Dec 2017 18:02:26 GMT
Server: AmazonS3
X-Amz-Id-2: FrBIve26eEa9rrZ+dEcOlesDAHKiX1grCxYKGH5mhmAVUIA1x+colUXaxSjqh2mwWEkfBQLa+JE=
X-Amz-Request-Id: C062F596822FA465
[NON-JSON BODY CONTENT HIDDEN]

fork/exec /root/.cf/plugins/temp902359024/221297826: no such file or directory
File is not a valid cf CLI plugin binary.
FAILED

Platform & Shell Details

docker golang:1.8-alpine3.6
RUN apk update
RUN apk upgrade

RUN apk --no-cache add jq bash

Install Cloud Foundry cli

ADD https://cli.run.pivotal.io/stable?release=linux64-binary /tmp/cf-cli.tgz
RUN mkdir -p /usr/local/bin &&
tar -xzf /tmp/cf-cli.tgz -C /usr/local/bin &&
cf --version &&
rm -f /tmp/cf-cli.tgz

Install cf cli Autopilot plugin

RUN apk add ca-certificates && update-ca-certificates && apk add openssl
ADD https://github.com/contraband/autopilot/releases/download/0.0.4/autopilot-linux /tmp/autopilot-linux

RUN chmod +x /tmp/autopilot-linux &&
cf install-plugin /tmp/autopilot-linux -f &&
rm -f /tmp/autopilot-linux

Any other relevant information

@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/154790478

The labels on this github issue will be updated when the story is started.

@XenoPhex
Copy link
Contributor

XenoPhex commented Feb 1, 2018

@rjain-pivotal After looking into this issue, it appears that the plugin is actually not complied statically!

$ ldd autopilot-linux 
	linux-vdso.so.1 =>  (0x00007ffdb6394000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f8b0a778000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8b0a398000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f8b0a997000)

So it fails during the cf install-plugin step in your docker file because alpine Linux does not have those libraries. The CF CLI tries to run the plugin it's installing during the install-plugin phase to get metadata about said plugin and a segfault occurs, thus causing the error you see in front of you.

There are two solutions:

  1. Compile the autopilot plugin yourself with the following build command:
$ CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -a -tags netgo -installsuffix netgo -ldflags "-w -s -extldflags \"-static\"" -o autopilot-linux
  1. submit an issue against autopilot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants