通过 vscode 远程开发使用的图像写入 "message of the day"

write "message of the day" by images used by vscode remote development

我在 vscode 中使用带有 Docker 图像的远程开发扩展,我希望当我在控制台中启动它时,我希望看到当天的消息“motd”。

.devcontaier 中的 Docker 文件末尾是这样的:

COPY motd /etc/
... # change the default user and WORKDIR
CMD cat /etc/motd && /bin/bash

如果我 运行 手动此图像我会看到消息,但是当 vscode 使用它时我在控制台中看不到它。

到目前为止我找到的最佳解决方案是

RUN echo "cat /etc/motd" >> $HOME/.bashrc
CMD /bin/bash