无法通过载波 fog-aws 将文件上传到 minio (docker-compose)
Can't upload file through carrierwave fog-aws to minio (docker-compose)
尝试通过载波 fog-aws 将文件上传到 minio 时出现错误 Excon::Error::Socket(getaddrinfo:名称或服务未知(SocketError))。
Docker撰写
version: '3'
services:
minio:
image: minio/minio
deploy:
resources:
limits:
memory: 256m
volumes:
- 'minio:/var/lib/minio'
environment:
- "MINIO_ACCESS_KEY=development"
- "MINIO_SECRET_KEY=development"
ports:
- "9000:9000"
command: server /export
rails:
build: .
command: bash -c 'rm -f /test/tmp/pids/server.pid && bundle && bundle exec rails s -p 3000 -b 0.0.0.0'
volumes:
- .:/test
ports:
- "3000:3000"
depends_on:
- minio
volumes:
minio:
载波初始化器
CarrierWave.configure do |config|
config.fog_provider = 'fog/aws'
config.fog_credentials = {
provider: 'AWS',
aws_access_key_id: 'development',
aws_secret_access_key: 'development',
region: 'us-east-1',
host: 'minio',
endpoint: 'http://localhost:9000'
}
config.fog_directory = 'test'
config.fog_public = false
# config.fog_attributes = { cache_control: "public, max-age=#{365.day.to_i}" } # optional, defaults to {}
end
你在 docker 容器中的 Carrierwave 应该指向你的服务 DNS,在你的情况下,下面的更改应该可以工作
CarrierWave.configure do |config|
config.fog_provider = 'fog/aws'
config.fog_credentials = {
provider: 'AWS',
aws_access_key_id: 'development',
aws_secret_access_key: 'development',
region: 'us-east-1',
host: 'minio',
endpoint: 'http://minio:9000'
}
config.fog_directory = 'test'
config.fog_public = false
# config.fog_attributes = { cache_control: "public, max-age=#{365.day.to_i}" } # optional, defaults to {}
end
尝试通过载波 fog-aws 将文件上传到 minio 时出现错误 Excon::Error::Socket(getaddrinfo:名称或服务未知(SocketError))。
Docker撰写
version: '3'
services:
minio:
image: minio/minio
deploy:
resources:
limits:
memory: 256m
volumes:
- 'minio:/var/lib/minio'
environment:
- "MINIO_ACCESS_KEY=development"
- "MINIO_SECRET_KEY=development"
ports:
- "9000:9000"
command: server /export
rails:
build: .
command: bash -c 'rm -f /test/tmp/pids/server.pid && bundle && bundle exec rails s -p 3000 -b 0.0.0.0'
volumes:
- .:/test
ports:
- "3000:3000"
depends_on:
- minio
volumes:
minio:
载波初始化器
CarrierWave.configure do |config|
config.fog_provider = 'fog/aws'
config.fog_credentials = {
provider: 'AWS',
aws_access_key_id: 'development',
aws_secret_access_key: 'development',
region: 'us-east-1',
host: 'minio',
endpoint: 'http://localhost:9000'
}
config.fog_directory = 'test'
config.fog_public = false
# config.fog_attributes = { cache_control: "public, max-age=#{365.day.to_i}" } # optional, defaults to {}
end
你在 docker 容器中的 Carrierwave 应该指向你的服务 DNS,在你的情况下,下面的更改应该可以工作
CarrierWave.configure do |config|
config.fog_provider = 'fog/aws'
config.fog_credentials = {
provider: 'AWS',
aws_access_key_id: 'development',
aws_secret_access_key: 'development',
region: 'us-east-1',
host: 'minio',
endpoint: 'http://minio:9000'
}
config.fog_directory = 'test'
config.fog_public = false
# config.fog_attributes = { cache_control: "public, max-age=#{365.day.to_i}" } # optional, defaults to {}
end