docker build error Gem::Ext::BuildError: ERROR: Failed to build gem native extension for mimemagic-0.3.9 docker build error Gem::Ext::BuildError: ERROR: Failed to build gem native extension for mimemagic-0.3.9 docker docker

docker build error Gem::Ext::BuildError: ERROR: Failed to build gem native extension for mimemagic-0.3.9


  1. Modify the Dockerfile to install the shared-mime-info package. E.g. on Debian-based images:

    RUN apt-get update && apt-get install -y shared-mime-info

  2. If it still won't work, then you may need to update the mimemagic gem. On your host, update mimemagic in the Rails app's Gemfile/Gemfile.lock. You may need to install shared-mime-info first: If the host is macOS, you may need to run brew install shared-mime-info; if the host is Ubuntu, you may need to run apt-get install shared-mime-info. Then run

    bundle update mimemagic

  3. If your Dockerfile downloads the Rails app from a repo, push your changes to that repo first. Or, for testing, modify the Dockerfile to copy in the Rails app from the host instead.


If you are using macOS, try the following

 brew install shared-mime-info bundle update mimemagic

And the try to bundle your gem file