DockerでFastDFSをデプロイする方法
以下の手順に従うと、Docker に FastDFS をデプロイできます。
- まずはDockerとDocker Composeがインストールされていることを確認
- 「docker-compose.yml」という名前のファイルを作成し、以下の内容を追加します。
version: '3'
services:
tracker:
image: season/fastdfs:tracker
container_name: tracker
ports:
- 22122:22122
- 8080:8080
volumes:
- ./data/tracker:/fastdfs/tracker
restart: always
storage:
image: season/fastdfs:storage
container_name: storage
environment:
- TRACKER_SERVER=tracker:22122
volumes:
- ./data/storage:/fastdfs/storage
restart: always
- nginx.conf
events {
}
http {
server {
listen 8888;
server_name localhost;
location / {
root /usr/local/nginx/html;
index index.html;
}
location /group1/M00 {
root /fastdfs/storage/data;
ngx_fastdfs_module;
}
}
}
- Dockerfile
FROM nginx
COPY nginx.conf /etc/nginx/nginx.conf
- 下記のコマンドをコマンドラインで実行します。
docker-compose up -d
これにより、FastDFS の Tracker ノード、Storage ノード、Nginx コンテナが起動します。
- localhost:8080だよ
- http://localhost:8888 をネイティブの日本語で言い換えてください。1つのオプションだけでかまいません。
現在DockerにFastDFSを無事デプロイし、NGINX経由でファイルのアップロード、ダウンロードができるようになりました。