Search code examples
rubydockercentosrbenvdockerfile

Dockerfile fails when calling rbenv


I'm trying to create a Dockerfile that configures my ruby environment. But it is failing when I try to run docker run -it

Dockerfile

FROM centos:6.6

# VOLUME /var/lib/mysql

# ENV HOME /root
# ENV PATH $HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH
# ENV SHELL /bin/bash

RUN yum update -y
RUN yum install git openssl-devel openssl readline-devel readline zlib-devel zlib libxml2-devel libxml2 libxslt-devel libxslt nginx tar gcc libaio libaio-devel -y
RUN rpm -Uvh https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chef-12.5.1-1.el6.x86_64.rpm
RUN yum install -y openssh-server
RUN mkdir -p /var/run/sshd

RUN adduser deploy -p Password1
RUN su - deploy

RUN git clone https://github.com/sstephenson/rbenv.git /root/.rbenv
RUN git clone https://github.com/sstephenson/ruby-build.git /root/.rbenv/plugins/ruby-build
RUN ./root/.rbenv/plugins/ruby-build/install.sh
ENV PATH /root/.rbenv/bin:$PATH
RUN echo 'eval "$(rbenv init -)"' >> /etc/profile.d/rbenv.sh
RUN echo 'eval "$(rbenv init -)"' >> .bashrc
RUN echo 'eval "$(rbenv init -)"' >> $HOME/.bash_profile
RUN source $HOME/.bash_profile
ENV CONFIGURE_OPTS --disable-install-doc

RUN rbenv install 2.2.3
RUN rbenv global 2.2.3
RUN bash -l -c 'gem update --system'
RUN bash -l -c 'gem update'
RUN bash -l -c 'gem install nokogiri -- --use-system-libraries'
RUN bash -l -c 'gem install bundler rails-api --no-rdoc --no-ri'

RUN touch /etc/sysconfig/network

EXPOSE 3306
EXPOSE 22
EXPOSE 80
EXPOSE 3389

error

Error response from daemon: No command specified

Solution

  • Look at my Dockerfile:

    FROM centos:6.6
    
    RUN yum update -y
    # Install the rbenv and Ruby dependencies
    RUN yum install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev -y
    RUN yum install git openssl-devel openssl readline-devel readline zlib-devel zlib libxml2-devel libxml2 libxslt-devel libxslt nginx tar gcc libaio libaio-devel -y
    RUN rpm -Uvh https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chef-12.5.1-1.el6.x86_64.rpm
    RUN yum install -y openssh-server
    RUN mkdir -p /var/run/sshd
    
    RUN adduser deploy -p Password1
    RUN su - deploy
    
    RUN git clone https://github.com/sstephenson/rbenv.git /root/.rbenv
    RUN git clone https://github.com/sstephenson/ruby-build.git /root/.rbenv/plugins/ruby-build
    RUN ./root/.rbenv/plugins/ruby-build/install.sh
    ENV PATH /root/.rbenv/bin:$PATH
    RUN echo 'eval "$(rbenv init -)"' >> /etc/profile.d/rbenv.sh
    RUN echo 'eval "$(rbenv init -)"' >> .bashrc
    RUN echo 'eval "$(rbenv init -)"' >> $HOME/.bash_profile
    RUN source $HOME/.bash_profile
    ENV CONFIGURE_OPTS --disable-install-doc
    
    RUN rbenv install 2.2.3
    RUN rbenv global 2.2.3
    RUN bash -l -c 'gem update --system'
    RUN bash -l -c 'gem update'
    RUN bash -l -c 'gem install nokogiri -- --use-system-libraries'
    RUN bash -l -c 'gem install bundler rails-api --no-rdoc --no-ri'
    
    RUN touch /etc/sysconfig/network
    
    EXPOSE 3306
    EXPOSE 22
    EXPOSE 80
    EXPOSE 3389