docker 上的回形针无法上传图片?

Paperclip on docker doesn't upload image?

我在 docker 开发环境下与 rails 一起使用回形针时遇到问题, 我按照 README 上的所有步骤将图像添加到现有模型,一切正常,但图像未在本地上传,即使我尝试直接上传到 S3,同样的问题完全没有错误,图片丢失文件夹为空?

我的代码很干净 我在 docker 中尝试过它并且有效,有什么建议吗?

值得一提的是,我什至尝试过载波波,效果很好,但我确实喜欢使用回形针,我确实发现它更轻便、更强大。

这是我的 Dockerfile

# Use the barebones version of Ruby 2.3.
FROM ruby:2.3.1-slim

# Optionally set a maintainer name to let people know who made this image.
MAINTAINER Chris de Bruin <chris@studytube.nl>

# Install dependencies:
# - build-essential: To ensure certain gems can be compiled
# - nodejs: Compile assets
# - imagemagick: converting images
# - file: needed by paperclip
# - wkhtmltopdf: generating pdf from html
# - libxml2: needed for nokogiri
RUN apt-get update && apt-get install -qq -y --no-install-recommends \
      build-essential libmysqlclient-dev git-core imagemagick wkhtmltopdf \
      libxml2 libxml2-dev libxslt1-dev nodejs file

# Set an environment variable to store where the app is installed to inside
# of the Docker image. The name matches the project name out of convention only.
ENV INSTALL_PATH /backend
RUN mkdir -p $INSTALL_PATH

# This sets the context of where commands will be ran in and is documented
# on Docker's website extensively.
WORKDIR $INSTALL_PATH

# Ensure gems are cached and only get updated when they change. This will
# drastically increase build times when your gems do not change.
COPY Gemfile Gemfile
COPY Gemfile.lock Gemfile.lock

RUN bundle install

# Copy in the application code from your work station at the current directory
# over to the working directory.
COPY . .

# Ensure the static assets are exposed through a volume so that nginx can read
# in these values later.
VOLUME ["$INSTALL_PATH/public"]

# The default command that gets ran will be to start the Puma server.
CMD bundle exec puma -C config/puma.rb

所以你应该有自己的 Dockerfile 并在你的 docker-compose.yml

中使用它