Error loading shared library libsqlite3.so.0 in Docker container
Dynamic libraries or shared objects (files ending in .so
) need to be present on the system in order to run the program. Your long RUN
command is installing sqlite-libs
and using it during the bundle install
phase, but then deleting it again; the sqlite
gem needs the dynamic library to still be installed.
I'd install this in a separate RUN
command. Since the development package is likely to depend on the runtime library, I'd install it first to reduce churn and download time (marginally).
RUN apk add --no-cache sqlite-libs
RUN apk add --no-cache --virtual=.build-deps \
git openssh-client build-base mariadb-dev sqlite-dev \
... \
&& apk del .build-deps
How to install jekyll to a Docker image?
To diagnose the issue you can jump into the container and dig into what's causing the issue.
$ docker run -ti --rm ruby:slim /bin/bash
root@bda37983a585:/# gem install jekyll
# ...
Alternatively there is always the jekyll docker image:
https://hub.docker.com/u/jekyll/
Good luck!
serving static files on sinatra
You can check the settings
object.
irb(main):001:0> require "sinatra"
=> true
irb(main):002:0> settings.public_folder
=> "/usr/lib/ruby/2.5.0/irb/public"
This allows you to create a route which returns the path, something like this
require 'sinatra'
get '/' do
settings.public_folder
end
Without more information I would guess that your public folder points to a wrong directory inside your docker because the project :root
points to a different directory that what you expect.
Installing gems with native extension on docker image
Your image is missing the gcc/g++ compiler and therefore it can't build any native code, as you can clearly see from the error message:
You have to install development tools first.
You can install the build-essential
metapackage to get a working build environment inside your image.
RUN apt-get install -y build-essential
Of course you need the above line before the gem install RUN command you already have
Related Topics
Why Are Methods in Ruby Documentation Preceded by a Hash Sign
How to Use Define_Method to Create Class Methods
Nokogiri Gem Installation Error
Eoferror: End of File Reached Issue With Net::Http
To Use Self. or Not.. in Rails
Convert Array of 2-Element Arrays into a Hash, Where Duplicate Keys Append Additional Values
Parallel Assignment Operator in Ruby
What Is a Regex to Match a String Not At the End of a Line
Rspec: Expect VS Expect With Block - What's the Difference
What Are the Magic $-Prefixed Variables in Ruby
Unzip (Zip, Tar, Tag.Gz) Files With Ruby
In Rails, How to Add a New Method to String Class
Ruby 1.9.2 How to Install Rmagick on Windows