Amazon-ssm-agent: Alpine Linux support

Created on 15 Nov 2018  Â·  12Comments  Â·  Source: aws/amazon-ssm-agent

Hi,
can be SSM agent installed on Linux Alpine OS? Ther's a supported version?

Most helpful comment

Any update on adding support for Alpine?

All 12 comments

Thank you for posting here. Currently, we don't support Alpine Linux OS officially. You could find information about supported OS and installation instructions in this link: https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-prereqs.html

Any update on adding support for Alpine?

For anyone coming across this issue via search, here's an unofficial Dockerfile that builds and runs the agent on Alpine: https://gist.github.com/ipmb/a8213fb459c27178f88dda7149c35be2

@ipmb Thanks to you, I'm able to confirm that it works.

But the Agent version displayed in Managed Instances is 2.3.0.0 and I couldn't use session manager, so here's how to solve it.

FROM golang:1.12-alpine as builder
ARG VERSION=2.3.930.0
RUN set -ex && apk add --no-cache make git gcc libc-dev curl bash && \
    curl -sLO https://github.com/aws/amazon-ssm-agent/archive/${VERSION}.tar.gz && \
    mkdir -p /go/src/github.com && \
    tar xzf ${VERSION}.tar.gz && \
    mv amazon-ssm-agent-${VERSION} /go/src/github.com/amazon-ssm-agent && \
    cd /go/src/github.com/amazon-ssm-agent && \
    echo ${VERSION} > /go/src/github.com/amazon-ssm-agent/VERSION && \
    gofmt -w agent && make checkstyle || ./Tools/bin/goimports -w agent && \
    make build-linux

FROM alpine
RUN set -ex && apk add --no-cache sudo ca-certificates && \
    adduser -D ssm-user && echo "ssm-user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/ssm-agent-users && \
    mkdir -p /etc/amazon/ssm
COPY --from=builder /go/src/github.com/amazon-ssm-agent/bin/linux_amd64/ /usr/bin
COPY --from=builder /go/src/github.com/amazon-ssm-agent/bin/amazon-ssm-agent.json.template /etc/amazon/ssm/amazon-ssm-agent.json
COPY --from=builder /go/src/github.com/amazon-ssm-agent/bin/seelog_unix.xml /etc/amazon/ssm/seelog.xml
CMD ["/usr/bin/amazon-ssm-agent"]

Without this line, the Agent version did not seem to be recognized correctly.

echo ${VERSION} > /go/src/github.com/amazon-ssm-agent/VERSION && \

We are consider use alpine as Fargate base container, it need this ssm-agent for troubleshooting, any advices?

I tried the Docker build step before, but the agent version always show as 2.3.0.0.

Starting Agent: amazon-ssm-agent - v2.3.0.0

I also checked the VERSION file is correct.

${VERSION} > /go/src/github.com/amazon-ssm-agent/VERSION

@enomotodev Hi, I found your solution works fine in 2.3.930.0, but when I upgrade to the latest 2.3.1509.0, it return back to show as 2.3.0.0.

@ipmb @enomotodev : Thank you guys for this work. However, I am running into PATH issues for goimports. I am getting the following issue:

/bin/sh: ./Tools/bin/goimports: not found

How did you guys fix this issue? I tried a lot to search for this error, but did not find much help online.

@enomotodev Hi, I found your solution works fine in 2.3.930.0, but when I upgrade to the latest 2.3.1509.0, it return back to show as 2.3.0.0.

Hi, did you found a workaround to get latest release running?

@AmyZhangAmz if you don't support alpine officially, what's the harm in leaving this ticket open and allowing someone to PR changes in to add support ?

Edit: I tried the above container with the following parameters

FROM golang:1.13-alpine as builder
ARG VERSION=3.0.431.0

And I was able to reproduce the version issue

✗ docker run 734c754346e7
...
2020-11-25 21:48:49 INFO [amazon-ssm-agent] amazon-ssm-agent - v3.0.0.0
...

I tried using apk add rpm and apk add dpkg to see if I could install it without having to compile it from source.

bash-5.0# wget "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ubuntu_64bit/session-manager-plugin.deb"
bash-5.0# dpkg -i session-manager-plugin.deb
dpkg: error processing archive session-manager-plugin.deb (--install):
 package architecture (amd64) does not match system (musl-linux-amd64)
Errors were encountered while processing:
 session-manager-plugin.deb
bash-5.0# dpkg --print-architecture
musl-linux-amd64
bash-5.0# wget "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/linux_64bit/session-manager-plugin.rpm"
bash-5.0# rpm -i session-manager-plugin.rpm
error: Failed dependencies:
    /bin/sh is needed by session-manager-plugin-1.2.30.0-1.x86_64
    libc.so.6()(64bit) is needed by session-manager-plugin-1.2.30.0-1.x86_64
    libc.so.6(GLIBC_2.2.5)(64bit) is needed by session-manager-plugin-1.2.30.0-1.x86_64
    libpthread.so.0()(64bit) is needed by session-manager-plugin-1.2.30.0-1.x86_64
    libpthread.so.0(GLIBC_2.2.5)(64bit) is needed by session-manager-plugin-1.2.30.0-1.x86_64
    libpthread.so.0(GLIBC_2.3.2)(64bit) is needed by session-manager-plugin-1.2.30.0-1.x86_64

This is too bad as the packer docker container uses alpine and it would have been nice to be able to use this binary directly in that container. Now we'll have to create an unofficial docker image based on centos or ubuntu just to use the session-manager-plugin.

Any news on an official support for Alpine Linux?

Bump

Any news on an official support for Alpine Linux so far?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

timoteialbu picture timoteialbu  Â·  5Comments

pbobov picture pbobov  Â·  5Comments

mvgfr picture mvgfr  Â·  4Comments

johnnyplaydrums picture johnnyplaydrums  Â·  5Comments

vane2804 picture vane2804  Â·  5Comments