# Errow while trying to install ruby on Dockerfile

**URL:** <https://forums.docker.com/t/errow-while-trying-to-install-ruby-on-dockerfile/13299>\
**Category:** Feature Requests\
**Tags:** docker\
**Created:** [May 24, 2016, 10:38am UTC](https://forums.docker.com/t/errow-while-trying-to-install-ruby-on-dockerfile/13299 "2016-05-24T10:38:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mertcancam](https://avatars.discourse-cdn.com/v4/letter/m/cc9497/32.png) [@mertcancam](https://forums.docker.com/u/mertcancam)\
**Post date:** [May 24, 2016, 10:38am UTC](https://forums.docker.com/t/errow-while-trying-to-install-ruby-on-dockerfile/13299/1 "2016-05-24T10:38:01Z")

</div>

**This is the inside of my Docker file;**

FROM ubuntu:xenial

```
    MAINTAINER Jose Mota <jose@josemota.net>
  
  
    
    

  
  
    
    # Just use bash.
  
  
    
    RUN rm /bin/sh && ln -s /bin/bash /bin/sh
  
  
    
    

  
  
    
    # Debian complains about the terminal environment on Docker. Use this.
  
  
    
    RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
  
  
    
    

  
  
    
    # Install base packages
  
  
    
    RUN apt-get update
  
  
    
    RUN apt-get upgrade -y
  
  
    
    RUN apt-get install -y curl wget ca-certificates build-essential autoconf python-software-properties libyaml-dev
  
  
    
    

  
  
    
    # Install nginx repositories
  
  
    
    RUN wget http://nginx.org/keys/nginx_signing.key
  
  
    
    RUN apt-key add nginx_signing.key
  
  
    
    RUN echo "deb http://nginx.org/packages/ubuntu/ trusty nginx" >> /etc/apt/sources.list.d/nginx.list
  
  
    
    RUN echo "deb-src http://nginx.org/packages/ubuntu/ trusty nginx" >> /etc/apt/sources.list.d/nginx.list
  
  
    
    

  
  
    
    # Finish installing remaining dependencies
  
  
    
    RUN apt-get update -y
  
  
    
    RUN apt-get install -y libssl-dev libreadline6 libreadline6-dev zlib1g zlib1g-dev bison openssl make git libpq-dev libsqlite3-dev nodejs nginx
  
  
    
    RUN apt-get clean
  
  
    
    

  
  
    
    # Force sudoers to not being asked the password
  
  
    
    RUN echo %sudo ALL=NOPASSWD: ALL >> /etc/sudoers
  
  
    
    

  
  
    
    # Ruby-install
  
  
    
    RUN wget -O ruby-install-0.5.0.tar.gz https://github.com/postmodern/ruby-install/archive/v0.5.0.tar.gz && tar -xzvf ruby-install-0.5.0.tar.gz && cd ruby-install-0.5.0/ && make install
  
  
    
    

  
  
    
    # chruby
  
  
    
    RUN wget -O chruby-0.3.9.tar.gz https://github.com/postmodern/chruby/archive/v0.3.9.tar.gz && tar -xzvf chruby-0.3.9.tar.gz && cd chruby-0.3.9/ && make install
  
  
    
    

  
  
    
    RUN rm -rf /var/cache/apt/* /tmp/*
  
  
    
    

  
  
    
    # Add a user just for running the app
  
  
    
    RUN useradd -m -G sudo app
  
  
    
    

  
  
    
    USER app
  
  
    
    WORKDIR /home/app
  
  
    
    

  
  
    
    # Install a Ruby version
  
  
    
    RUN ruby-install ruby
  
  
    
    RUN rm -rf /home/app/src

```

Error that i am facing when i run sudo docker build .

> > > Installing ruby 2.1.3 into /home/app/.rubies/ruby-2.1.3 …  
> > > Installing dependencies for ruby 2.1.3 …  
> > > /usr/local/bin/…/share/ruby-install/ruby-install.sh: line 104: sudo: command not found  
> > > !!! Installing dependencies failed!  
> > > The command ‘/bin/sh -c ruby-install ruby’ returned a non-zero code: 255

I WOULD BE VERY HAPPY IF ANYONE COULD HELP

---

<div class="post-metadata">

**Author:** ![nathanleclaire](https://avatars.discourse-cdn.com/v4/letter/n/ebca7d/32.png) [@nathanleclaire](https://forums.docker.com/u/nathanleclaire)\
**Post date:** [May 24, 2016, 6:55pm UTC](https://forums.docker.com/t/errow-while-trying-to-install-ruby-on-dockerfile/13299/2 "2016-05-24T18:55:31Z")

</div>

```auto
 sudo: command not found

```

Did you read your error message?

`sudo` program is not installed within the container. Usually this is fixable by just dropping the `sudo` since containers run as root by default, but looks like you’re depending on another program which needs it.

`apt-get install sudo` before attempting to invoke it.
