どうしても古いままの環境をいじらざるを得ない時ありますよね...
Dockerfile
FROM centos:6 RUN \ sed -i -e "s/^mirrorlist=http:\/\/mirrorlist.centos.org/#mirrorlist=http:\/\/mirrorlist.centos.org/g" /etc/yum.repos.d/CentOS-Base.repo &&\ sed -i -e "s/^#baseurl=http:\/\/mirror.centos.org/baseurl=http:\/\/vault.centos.org/g" /etc/yum.repos.d/CentOS-Base.repo RUN yum -y install \ git \ bzip2 \ gcc \ openssl-devel \ readline-devel \ zlib-devel RUN git clone https://github.com/rbenv/rbenv.git ~/.rbenv RUN git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build RUN echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile RUN echo 'eval "$(rbenv init - bash)"' >> ~/.bash_profile RUN \ source ~/.bash_profile && \ rbenv install 2.7.4 && \ rbenv local 2.7.4 RUN yum -y install wget
ポイント
- CentOS6のサポートが終わってしまったため、リポジトリがもう無い。そのため、古いリポジトリを残してくれている
vault.centos.org
をリポジトリの参照先にする - 中に入った後、
source ~/.bash_profile
する必要がある。これどうすれば省略できますかね