1

I have a docker image (which is delivered as-is, with no Dockerfile etc.) with Ruby application in it, when I try to run docker container with docker run application_image bundle exec puma -C config/puma.rb I get starting container process caused "exec: \"bundle\": executable file not found in $PATH": unknown.. All suggested fixes for this are to specidy stuff in Dockerfile (whick is not present there). Is there away to run container this way?

  • Have you tried `docker inspect ` to discover what `CMD` and `ENTRYPOINT` are? You need some idea of what the image is running so that you can figure out what args it expects. – chash Oct 05 '19 at 16:08
  • `Entrypoint` there is `null` and `CMD` not present at all – user3115061 Oct 05 '19 at 16:15
  • 1
    Maybe try `docker run -it ` and poke around in there and see if you can figure out how to run whatever this application is. Then either extend the image as suggested below, or use `-v` to mount a script? – chash Oct 05 '19 at 16:26
  • I would suggest building a new image that contains the software you need, or contacting the original author of the image. Many Docker images in fact don't contain the Ruby-specific `bundler` tool (and there are ways to package Ruby applications in Docker that don't require it). – David Maze Oct 05 '19 at 17:13

2 Answers2

0

There are some walk-around maybe.

  • Create another docker image based on the existing one, with bundle installed
  • Install bundle before actually running the application
John
  • 1,654
  • 1
  • 14
  • 21
0

It's best if you can ask the image maintainer for instructions. If that fails try exploring the docker image first like @hmm suggested see: https://stackoverflow.com/a/58256085/5641227 on how to do that.

Then either extract the image contents if your are allowed to and build it your self from scratch.

Or try building a new image from the one you have and add new build steps to the new Dockerfile:

FROM <your-current-image:and-tag>

RUN gem install bundler -v "~>2.0.2" --no-document --quiet --force

CMD ["bundle", "exec", "puma -C config/puma.rb"]

Then just run it after you tag and build your new image:

docker run new_application_image

Also, you need to have the right version of bundler. 2.0.2 is just an example. having a conflicting version won't work.

Khalil Gharbaoui
  • 6,557
  • 2
  • 19
  • 26