简体   繁体   English

如何在Aptible ssh登录上显示自定义消息

[英]How to display custom message on Aptible ssh login

I want to display a custom message whenever anyone creates a SSH session on Apitble. 我想在任何人在Apitble上创建SSH会话时显示一条自定义消息。

To do this, I have added a entrypoint script in Dockerfile to display the message. 为此,我在Dockerfile中添加了一个入口点脚本来显示消息。

echo "message"
exec "$@"

But this is causing before_release commands execution failure. 但这会导致before_release命令执行失败。

Apitble is passing chained commands, for ex: command1 args && command2 args to the docker. Apitble正在将链接的命令传递给docker,例如: command1 args && command2 args
Docker is executing command1 and treating args && command2 args as it's arguments and throwing this error. Docker正在执行command1并将args && command2 args作为参数,并抛出此错误。

command1: error: unrecognized arguments: && command2 args

I am not able to reproduced this issue with local containers. 我无法使用本地容器重现此问题。 I don't know how Aptible passes arguments to container for execution but, talked to support and they provided two solutions. 我不知道Aptible如何将参数传递给容器以执行,但是与支持进行了交谈,他们提供了两种解决方案。

  1. Put commands inside a script, and call that one command alone from before_release . 将命令放入脚本中,然后从before_release单独调用该命令。
  2. Use exec /bin/sh -c "$*" , instead of exec "$@" in your entrypoint.sh script 在您的entrypoint.sh脚本中使用exec /bin/sh -c "$*"代替exec "$@"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM