社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  docker

在docker镜像中安装sdkman

trinath • 5 年前 • 1352 次点击  

在ubantu映像中安装sdkman时出错。

FROM ubuntu:16.04
RUN apt-get update
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
RUN apt-get -qq -y install curl
RUN curl -s https://get.sdkman.io | bash
RUN chmod a+x "$HOME/.sdkman/bin/sdkman-init.sh"
RUN source "$HOME/.sdkman/bin/sdkman-init.sh"
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/43260
 
1352 次点击  
文章 [ 2 ]  |  最新文章 5 年前
MisterSheep
Reply   •   1 楼
MisterSheep    6 年前

看起来像是 sdkman 安装失败。 当我在上面运行你的代码时,它抱怨缺少 unzip zip 包装。

在满足依赖关系之后,还需要将init脚本标记为可执行:

chmod a+x "$HOME/.sdkman/bin/sdkman-init.sh"

所以你的档案应该看起来像:

FROM ubuntu:16.04
RUN apt-get update
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
RUN apt-get -q -y install curl zip unzip
RUN curl -s https://get.sdkman.io | bash
RUN chmod a+x "$HOME/.sdkman/bin/sdkman-init.sh"
RUN source "$HOME/.sdkman/bin/sdkman-init.sh"

警察:被揍了一顿!

michalhosna
Reply   •   2 楼
michalhosna    6 年前

安装 unzip 和; zip ,这意味着改变

RUN apt-get -qq -y install curl

RUN apt-get -qq -y install curl unzip zip

或更好

RUN apt-get -qq -y install \
    curl \
    unzip \
    zip

当您尝试构建dockerfile时,您将得到

    .....

    Step 5/6 : RUN curl -s https://get.sdkman.io | bash
    ---> Running in 1ce678a59561

    --- SDKMAN LOGO ---

    Now attempting installation...

    Looking for a previous installation of SDKMAN...
    Looking for unzip...
    Not found.
    ======================================================================================================
    Please install unzip on your system using your favourite package manager.

    Restart after installing unzip.
    ======================================================================================================

    Removing intermediate container 1ce678a59561
    ---> 22211eafd50c
    Step 6/6 : RUN source "$HOME/.sdkman/bin/sdkman-init.sh"
    ---> Running in 1c5cb7d79ef0
    /bin/sh: /root/.sdkman/bin/sdkman-init.sh: No such file or directory
    The command '/bin/sh -c source "$HOME/.sdkman/bin/sdkman-init.sh"' returned a non-zero code: 1

你需要做的就是写在那里。

    ======================================================================================================
    Please install unzip on your system using your favourite package manager.

    Restart after installing unzip.
    ======================================================================================================

当你安装解压,你得到相同的错误与ZIP,安装后,一切正常。

所以,请阅读日志/命令输出。尤其是在这里,它真的很明显:-)

P.S.如果 curl -s https://get.sdkman.io | bash 使用非零代码退出时,在生成失败的地方更容易看到它。这样下一个命令就失败了。但那不是你能解决的。