我正在尝试使用docker容器中的 Apache ftpserver 运行FTP服务。 容器启动时没有问题,并且可以登录。但是,它无法使用被动模式建立数据连接。 到目前为止,它在本地运行,并且未设置外部ip,所以我认为它可以获取内部本地ip。
无论是否设置外部ip(setPassiveExternalAddress),我都尝试过运气。
有人成功使用docker容器成功运行Apache ftpserver吗?
weights=None
答案 0 :(得分:0)
此Dockerfile对我有用(请参阅有关其使用方式的评论)
FROM openjdk:13-jdk-alpine
# Build this with:
# docker build -t "apache_mina_ftpserver:1.1.1" .
# Run this with:
# docker run -v /tmp:apache-ftpserver-1.1.1/res/home/ -p 2121-2199:2121-2199 -d apache_mina_ftpserver:1.1.1
# Then connect with
# ftp -p localhost 2121
# and log in with admin:admin
RUN wget https://archive.apache.org/dist/mina/ftpserver/1.1.1/dist/apache-ftpserver-1.1.1.zip
RUN unzip -q apache-ftpserver-1.1.1.zip
# configure additional passive ports
RUN sed -i 's#<\/ssl>#<\/ssl><data-connection><passive ports="2122-2199"\/><\/data-connection>#g' apache-ftpserver-1.1.1/res/conf/ftpd-typical.xml
EXPOSE 2121-2199
CMD ["sh", "-c", "apache-ftpserver-1.1.1/bin/ftpd.sh res/conf/ftpd-typical.xml"]
答案 1 :(得分:0)
基于Orbiter的配置,我将其更改为端口21。并且还修复了他的docker文件中的错字。
FROM openjdk:13-jdk-alpine
# Build this with:
# docker build -t "apache_mina_ftpserver:1.1.1" .
# Run this with:
# docker run --name ftpd -v /tmp:/apache-ftpserver-1.1.1/res/home/:z -p 2122-2199:2122-2199 -p 21:21 -d apache_mina_ftpserver:1.1.1
# Then connect with
# ftp -p localhost 21
# and log in with admin:admin
RUN wget https://archive.apache.org/dist/mina/ftpserver/1.1.1/dist/apache-ftpserver-1.1.1.zip
RUN unzip -q apache-ftpserver-1.1.1.zip
# configure additional passive ports
RUN sed -i 's#<\/ssl>#<\/ssl><data-connection><passive ports="2122-2199"\/><\/data-connection>#g' apache-ftpserver-1.1.1/res/conf/ftpd-typical.xml
RUN sed -i 's/2121/21/g' apache-ftpserver-1.1.1/res/conf/ftpd-typical.xml
# If you'd like to configure the admin password, remove the comment of below line and change <yourpassword> to your own password. Get your password by using echo -n 'yourpassword' | md5sum
# RUN sed -i 's/21232F297A57A5A743894A0E4A801FC3/<yourpassword>/g' apache-ftpserver-1.1.1/res/conf/users.properties
EXPOSE 21
EXPOSE 2122-2199
CMD ["sh", "-c", "apache-ftpserver-1.1.1/bin/ftpd.sh res/conf/ftpd-typical.xml"]