【发布时间】:2019-01-28 22:08:56
【问题描述】:
这是 Dockerfile 中的脚本。当我直接进入 docker 并手动运行命令时,它工作正常,但为什么不能从 Dockerfile 中运行。
Dockerfile:
FROM ubuntu:16.04
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
RUN apt-get update
RUN apt-get install -y build-essential libssl-dev
RUN apt-get install -y curl git sudo
RUN curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh -o install_nvm.sh
RUN /bin/sh install_nvm.sh
RUN source ~/.profile
错误:
mesg: ttyname failed: 设备的 ioctl 不合适
我已经尝试了一些解决方案,比如运行它
RUN /bin/sh -c "source ~/.profile" 和其他一些但没有解决问题。
【问题讨论】:
-
~/.profile里面是什么? -
它只有一个设置环境的命令。 pastebin.com/RpQg58r4@JackGore
-
您可能应该只使用您需要的版本的standard node image,而不是尝试安装 nvm。即使您可以
RUN . $HOME/.profile请注意,这将是一个空操作,因为该 shell 环境不会延续到未来的步骤。 -
那里的解决方案对我不起作用
标签: docker dockerfile