Skip to content

Instantly share code, notes, and snippets.

@rafaeltuelho
Last active February 23, 2022 04:56
Show Gist options
  • Star 23 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save rafaeltuelho/6b29827a9337f06160a9 to your computer and use it in GitHub Desktop.
Save rafaeltuelho/6b29827a9337f06160a9 to your computer and use it in GitHub Desktop.
installing gosu on a centos docker box
# Install gosu.  https://github.com/tianon/gosu
ENV GOSU_VERSION=1.11
RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
    && curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64" \
    && curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64.asc" \
    && gpg --verify /usr/local/bin/gosu.asc \
    && rm /usr/local/bin/gosu.asc \
    && rm -r /root/.gnupg/ \
    && chmod +x /usr/local/bin/gosu \
    # Verify that the binary works
    && gosu nobody true
@ArSa-Apps
Copy link

Thx

@mwakerman
Copy link

+1

@kcelestine
Copy link

+1

@jamesooo
Copy link

jamesooo commented Nov 3, 2016

Thanks!

@mario21ic
Copy link

+1

@webysther
Copy link

webysther commented Jan 26, 2017

In some cases the gpg fail, use alternative here: tianon/gosu#17

@tedgin
Copy link

tedgin commented Jul 18, 2017

Thanks!

Copy link

ghost commented Sep 5, 2018

@tedgin - This command doesn't works for cenos. Its giving me below error

$ RUN gpg --keyserver pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
>     && curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/1.2/gosu-amd64" \
>     && curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/1.2/gosu-amd64.asc" \
>     && gpg --verify /usr/local/bin/gosu.asc \
>     && rm /usr/local/bin/gosu.asc \
>     && rm -r /root/.gnupg/ \
>     && chmod +x /usr/local/bin/gosu
-bash: RUN: command not found

@adveres
Copy link

adveres commented Oct 24, 2018

@tedgin - This command doesn't works for cenos. Its giving me below error

-bash: RUN: command not found

@Javaprogramer, Docker commands are not valid Linux command-line commands. In this case, remove the RUN command before pasting it into a terminal.


Also, thank you @rafaeltuelho! I have modified your original snippet like so.

  1. Changed keyserver to match https://github.com/tianon/gosu README.
    • I strongly encourage others to check the README and verify the keyserver/GPG key themselves prior to just copy/pasting a github snippet.
  2. Use env var for version. 1.11 is newest as of 10/24/2018.
  3. Added check at the end to verify binary works (via https://github.com/tianon/gosu/blob/master/INSTALL.md)
# Install gosu.  https://github.com/tianon/gosu
ENV GOSU_VERSION=1.11
RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
    && curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64" \
    && curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64.asc" \
    && gpg --verify /usr/local/bin/gosu.asc \
    && rm /usr/local/bin/gosu.asc \
    && rm -r /root/.gnupg/ \
    && chmod +x /usr/local/bin/gosu \
    # Verify that the binary works
    && gosu nobody true

@josemiguel-diaz-external

Thanks @adveres

@zhangagua
Copy link

thanks!!!

@xbmono
Copy link

xbmono commented Dec 2, 2020

Thanks!

@mtanimura55
Copy link

2021.07.02

Succeeded.

ENV GOSU_VERSION=1.11
RUN gpg --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
    && curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64" \
    && curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64.asc" \
    && gpg --verify /usr/local/bin/gosu.asc \
    && rm /usr/local/bin/gosu.asc \
    && rm -r /root/.gnupg/ \
    && chmod +x /usr/local/bin/gosu \
    # Verify that the binary works
    && gosu nobody true

Changed:
--keyserver hkps://keys.openpgp.org

Ref. https://github.com/tianon/gosu/blob/master/INSTALL.md

@sasi1212
Copy link

Cudo 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment