长话短说:
docker -it --rm myimage /bin/bash命令不会将bash作为登录shell启动。
说明:
当您运行
$ docker -it --rm myimage/bin/bash没有它的invoke庆典
-l,这使得选项
bash行为就好像它被调用作为登录shell,
rvm初始化依赖于
source-ing分词
/path/to/.rvm/scripts/rvm或
/etc/profile.d/rvm.sh和初始化是
.bash_profile或
.bashrc或任何其他初始化脚本。
我该如何解决?
如果不这样做,请始终使用
rubyfrom
rvmadd
-l选项。
这是一个Dockerfile,安装
ruby了
rvm:
FROM DebianARG DEBIAN_FRonTEND=noninteractiveRUN apt-get update -q && apt-get install -qy procps curl ca-certificates gnupg2 build-essential --no-install-recommends && apt-get cleanRUN gpg2 --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3RUN curl -sSL https://get.rvm.io | bash -sRUN /bin/bash -l -c ". /etc/profile.d/rvm.sh && rvm install 2.3.3"# The entry point here is an initialization process, # it will be used as arguments for e.g.# `docker run` command ENTRYPOINT ["/bin/bash", "-l", "-c"]
运行容器:
➠ docker_templates : docker run -ti --rm rvm 'ruby -v'ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]➠ docker_templates : docker run -ti --rm rvm 'rvm -v'rvm 1.29.1 (master) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io/]➠ docker_templates : docker run -ti --rm rvm bashroot@efa1bf7cec62:/# rvm -vrvm 1.29.1 (master) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io/]root@efa1bf7cec62:/# ruby -vruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]root@efa1bf7cec62:/#



