LoginSignup
6
6

More than 5 years have passed since last update.

S3シミュレーターをDockerで動かす

Last updated at Posted at 2017-01-27

概要

s3rverはS3のシミュレーターです。
以下のことが可能です。

Buckets

  • Create bucket
  • Delete bucket
  • List buckets
  • List content of buckets (prefix, delimiter, marker and max keys, common prefixes)

Objects

  • Put object (support for metadata, including ContentEncoding (gzipped files)
  • Delete object(s)
  • Get object (including using the HEAD method)
  • Get dummy ACLs for an object
  • Copy object (including updating of metadata)

手順

s3rverをDockerで動かし、バケット作成、およびファイルのアップロードやダウンロードをするための手順を以下に示します。

  1. Dockerfileの作成
FROM node

RUN npm install -g s3-proxy
RUN npm install -g s3rver

RUN mkdir -p /data

EXPOSE 4567

CMD ["s3rver", "-d", "/data", "-p", "4567", "-h", "0.0.0.0"]
  1. イメージの作成
docker build -t hryshtk/s3rver .
  1. コンテナの起動
docker run -d -p 4567:4567 hryshtk/s3rver
  1. バケットの作成
curl -XPUT localhost:4567/hoge
  1. ファイルのアップロード
curl -XPUT -T hello.txt localhost:4567/hoge/
  1. ファイルのダウンロード
curl -XGET localhost:4567/hoge/hello.txt

参考URL
https://www.npmjs.com/package/s3rver

6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6