搭建
直接使用我写好的 docker-compose
脚本即可。
Dockerfile
# 依赖的镜像
FROM delfer/alpine-ftp-server:latest
#镜像创建者的信息
MAINTAINER terwer "[email protected]"
# 设置编码
ENV LANG C.UTF-8
# 设置时区
ENV TZ Asia/Shanghai
# docker inspect portable-ftpserver | grep IPAddres
docker-compose.yml
# docker-compose --log-level INFO up --build portable-mina-ftpserver
# docker-compose --log-level INFO up
version: '3'
services:
portable-redis7:
image: terwer/ftpserver:latest
container_name: portable-ftpserver
build:
context: .
dockerfile: Dockerfile
ports:
- "21:21"
- "21000-21010:21000-21010"
environment:
- "TZ=Asia/Shanghai"
- "USERS=terwer|123456|/Users/terwer/ftppath|10000"
- "ADDRESS=localhost"
volumes:
- ./ftphome:/Users/terwer/ftppath
stdin_open: true
restart: "no"
networks:
- local-dev
networks:
local-dev:
external: true
运行 ftpserver
在 docker-compose.yml
的同级目录,新建一个 ftphome
文件夹,然后运行下面命令即可。
docker compose up --build
连接 ftp 测试
使用 Filezilla
信息如下:
Host localhost
Port 21 # 端口默认是21,可以不写
User terwer
Password 123456
效果:
标签:ftp,compose,21,terwer,--,ftpserver,服务器,docker,轻量级 From: https://www.cnblogs.com/tangyouwei/p/build-a-lightweight-ftp-server-z1ch9hr.html