gem: command not found

I have bash file which build gem files and launch my program:

cd /src/stackify-api
rm *.gem
gem build stackify.gemspec
gem install stackify-0.1.0.gem

cd /src/stackify-classificator
rm *.gem
gem build stackify-classificator.gemspec
gem install stackify-classificator-0.1.1.gem

cd /src/bin
ruby console-task.rb

I use it in the docker container. It works fine if I launch the container interactively and run this bash-file manually:

  • Creating HazelCast cluster running on multiple docker containers
  • not able to start uwsgi as a service in docker
  • Docker private registry issue
  • How can I call shell script from one container to another container and capture output without ssh in Docker Swarm?
  • How can I setup and deploy a database with Deis (PaaS)
  • What makes docker secure?
  •  ~ » docker run -it -v /mnt/lacie/online/btsync/development:/src stack_rvm /bin/bash              
    root@898cec6a7d85:/# /src/build.sh 
      ...
      Successfully built RubyGem
      Name: stackify
      Version: 0.1.0
      File: stackify-0.1.0.gem
    

    But when I am trying to launch this script in the docker like this I get the error message:

     ~ » docker run -it -v /mnt/lacie/online/btsync/development:/src stack_rvm /bin/bash /src/build.sh
    /src/build.sh: line 5: gem: command not found
    

    Why and how can I fix it ?

  • Kubernetes networking issue
  • How do I deploy this docker app on digital ocean?
  • sbt docker:stage returns java.util.regex.PatternSyntaxException error
  • How to access private Docker Hub repository from Kubernetes on Vagrant
  • Using docker on Mac. Is it possible to start docker daemon using docker-machine and pass in arguments?
  • Passing Different Arguments When Running Docker Image Multiple Times
  • One Solution collect form web for “gem: command not found”

    I have found the answer – use -c -l:

    ~ » docker run -it -v /mnt/lacie/online/btsync/development:/src stack_rvm /bin/bash -c -l /src/build.sh
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.