Для запуска ftpd нам потребуется создать несколько папок
mkdir -p ./ftpd/{logs,passwd} && cd ftpd
добавляем содержимое docker-compose.yml
cat > docker-compose.yml << EOF
version: '3.3'
services:
ftpd:
image: stilliard/pure-ftpd
container_name: ftpd
# ports:
# - "21:21"
# - "30000-30009:30000-30009"
volumes:
- "/data/ftp:/home"
- "./passwd:/etc/pure-ftpd/passwd"
- "./logs:/var/log/pure-ftpd"
environment:
FTP_MAX_CLIENTS: "5"
ADDED_FLAGS: "-d -d"
PUBLICHOST: ftp.(DOMAINE)
FTP_USER_NAME: (USERNAME)
FTP_USER_PASS: (PASSWORD)
FTP_USER_HOME: /home/backup
restart: always
labels:
- traefik.enable=true
- traefik.tcp.routers.router-ftp.entrypoints=entrypoint-ftp
- traefik.tcp.routers.router-ftp.rule=HostSNI(`*`)
- traefik.tcp.routers.router-ftp.service=service-ftp
- traefik.tcp.routers.router-ftp-passive-0.entrypoints=entrypoint-ftp-passive-0
- traefik.tcp.routers.router-ftp-passive-0.rule=HostSNI(`*`)
- traefik.tcp.routers.router-ftp-passive-0.service=service-ftp-passive-0
- traefik.tcp.routers.router-ftp-passive-1.entrypoints=entrypoint-ftp-passive-1
- traefik.tcp.routers.router-ftp-passive-1.rule=HostSNI(`*`)
- traefik.tcp.routers.router-ftp-passive-1.service=service-ftp-passive-1
- traefik.tcp.routers.router-ftp-passive-2.entrypoints=entrypoint-ftp-passive-2
- traefik.tcp.routers.router-ftp-passive-2.rule=HostSNI(`*`)
- traefik.tcp.routers.router-ftp-passive-2.service=service-ftp-passive-2
- traefik.tcp.routers.router-ftp-passive-3.entrypoints=entrypoint-ftp-passive-3
- traefik.tcp.routers.router-ftp-passive-3.rule=HostSNI(`*`)
- traefik.tcp.routers.router-ftp-passive-3.service=service-ftp-passive-3
- traefik.tcp.routers.router-ftp-passive-4.entrypoints=entrypoint-ftp-passive-4
- traefik.tcp.routers.router-ftp-passive-4.rule=HostSNI(`*`)
- traefik.tcp.routers.router-ftp-passive-4.service=service-ftp-passive-4
- traefik.tcp.routers.router-ftp-passive-5.entrypoints=entrypoint-ftp-passive-5
- traefik.tcp.routers.router-ftp-passive-5.rule=HostSNI(`*`)
- traefik.tcp.routers.router-ftp-passive-5.service=service-ftp-passive-5
- traefik.tcp.routers.router-ftp-passive-6.entrypoints=entrypoint-ftp-passive-6
- traefik.tcp.routers.router-ftp-passive-6.rule=HostSNI(`*`)
- traefik.tcp.routers.router-ftp-passive-6.service=service-ftp-passive-6
- traefik.tcp.routers.router-ftp-passive-7.entrypoints=entrypoint-ftp-passive-7
- traefik.tcp.routers.router-ftp-passive-7.rule=HostSNI(`*`)
- traefik.tcp.routers.router-ftp-passive-7.service=service-ftp-passive-7
- traefik.tcp.routers.router-ftp-passive-8.entrypoints=entrypoint-ftp-passive-8
- traefik.tcp.routers.router-ftp-passive-8.rule=HostSNI(`*`)
- traefik.tcp.routers.router-ftp-passive-8.service=service-ftp-passive-8
- traefik.tcp.routers.router-ftp-passive-9.entrypoints=entrypoint-ftp-passive-9
- traefik.tcp.routers.router-ftp-passive-9.rule=HostSNI(`*`)
- traefik.tcp.routers.router-ftp-passive-9.service=service-ftp-passive-9
- traefik.tcp.services.service-ftp.loadbalancer.server.port=21
- traefik.tcp.services.service-ftp-passive-0.loadbalancer.server.port=30000
- traefik.tcp.services.service-ftp-passive-1.loadbalancer.server.port=30001
- traefik.tcp.services.service-ftp-passive-2.loadbalancer.server.port=30002
- traefik.tcp.services.service-ftp-passive-3.loadbalancer.server.port=30003
- traefik.tcp.services.service-ftp-passive-4.loadbalancer.server.port=30004
- traefik.tcp.services.service-ftp-passive-5.loadbalancer.server.port=30005
- traefik.tcp.services.service-ftp-passive-6.loadbalancer.server.port=30006
- traefik.tcp.services.service-ftp-passive-7.loadbalancer.server.port=30007
- traefik.tcp.services.service-ftp-passive-8.loadbalancer.server.port=30008
- traefik.tcp.services.service-ftp-passive-9.loadbalancer.server.port=30009
networks:
default:
external:
name: (TRAEFIK-NETWORK)
EOF
запускаем ftpd
docker-compose up -d
так же у traefik в docker-compose.yml необходимо изменить секции "command" и "ports"
в секцию command добавляем
command:
- --entrypoints.entrypoint-ftp.address=:21
- --entrypoints.entrypoint-ftp-passive-0.address=:30000
- --entrypoints.entrypoint-ftp-passive-1.address=:30001
- --entrypoints.entrypoint-ftp-passive-2.address=:30002
- --entrypoints.entrypoint-ftp-passive-3.address=:30003
- --entrypoints.entrypoint-ftp-passive-4.address=:30004
- --entrypoints.entrypoint-ftp-passive-5.address=:30005
- --entrypoints.entrypoint-ftp-passive-6.address=:30006
- --entrypoints.entrypoint-ftp-passive-7.address=:30007
- --entrypoints.entrypoint-ftp-passive-8.address=:30008
- --entrypoints.entrypoint-ftp-passive-9.address=:30009
в секцию ports добавляем
ports:
- "21:21"
- "30000-30009:30000-30009"
после пересобираем treafik
docker-compose up -d