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:

  • Getting java.lang.OutOfMemoryError thrown at me when running Spark inside Docker
  • Docker doesn't cache npm install
  • Docker WordPress High CPU Usage
  • .NET Core project does not have a lock file on docker
  • Container networking on between docker hosts on different VMs
  • How to connect to docker host from container on Windows 10 (Docker for Windows)
  •  ~ » 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 ?

  • exposing container ports for django application
  • What is a Docker tag (looking for a definition)?
  • unable to run a container with volume on glusterfs
  • Setting docker environment variable to existing environment variable with different name
  • Is there any way to get logs in Docker Swarm?
  • Can't access container's web server on localhost:80
  • 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.