How to create an image of dockers with a passenger?

I am trying to create an image of dockers using the application and the passenger on the rails. I read this article: https://intercityup.com/blog/how-i-build-a-docker-image-for-my-rails-app.html

It works well, the gems are well installed, but when I call the application, I have this error:

Message from the application: libruby.so.2.1: cannot open the file of shared objects: there is no such file or directory - / home / app / webapp / vendor / bundle / ruby ​​/ 2.1.0 / extensions / x86_64-linux / 2.1. 0 / pg-0.18.3 / pg_ext.so (LoadError)

And when I connect to the image, the file is / home / app / webapp / vendor / bundle / ruby ​​/ 2.1.0 / extensions / x86_64-linux / 2.1.0 / pg-0.18.3 / pg_ext. so it really exists.

Therefore, I do not understand what happened.

My docker file:

FROM phusion/passenger-ruby21:0.9.12
MAINTAINER Eric L'Hostis "eric.lhostis@gmail.com"

# Set correct environment variables.
ENV HOME /root

# Use baseimage-docker init system.
CMD ["/sbin/my_init"]

# Conf Nginx / Passenger
RUN rm -f /etc/service/nginx/down
RUN rm /etc/nginx/sites-enabled/default
ADD nginx.conf /etc/nginx/sites-enabled/webapp.conf

# Prepare folders
RUN mkdir /home/app/webapp
WORKDIR /tmp
ADD Gemfile /tmp/
ADD Gemfile.lock /tmp/
RUN bundle install

# Add the rails app
ADD . /home/app/webapp

/ .

docker build -t myimage .
docker run -d -p 80:80 myimage

libs: libpq-dev, nodejs, build-essential, postgresql : (

+4
2

, postgres , libpq-dev .

- , , , ​​ lib.

:

RUN apt-get install -y libpq-dev 

DOCKERFILE lib.

:

RUN apt-get update && \
    apt-get install -y libpq-dev --no-install-recommends && \
    rm -rf /var/lib/apt/lists/* && \
    apt-get clean

, .

:

, , , . 400 . , , ~ 960 . , :latest, (~ 211 ).

0

Source: https://habr.com/ru/post/1613110/


All Articles