私信  •  关注

michalhosna

michalhosna 最近回复了
6 年前
回复了 michalhosna 创建的主题 » 用docker compose psql实现knex迁移

简单地添加 depends_on 到服务器服务应该做到这一点。

services:
    server:
        depends_on:
            - postgres
        ...

这将导致docker compose在服务器容器之前启动postgres容器。不过,它不会等待Postgres准备就绪。在这种情况下,这应该不是问题,因为postgres启动非常快。

如果你想要更坚固的东西,或者 取决于 不起作用,您可以将入口点包装脚本添加到容器中。见 https://docs.docker.com/compose/startup-order/ ,您可以从中了解更多信息也有指向工具的链接,因此您不必从头开始编写自己的脚本。

6 年前
回复了 michalhosna 创建的主题 » 在docker镜像中安装sdkman

安装 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 使用非零代码退出时,在生成失败的地方更容易看到它。这样下一个命令就失败了。但那不是你能解决的。