2

WindowsホストのDockerコンテナでFTPサーバーを実行しています。SSH と FTP 用にポート 22 と 21 をマップ (-p) しました。ホストから ftp サーバーへの FTP 接続がうまくいきません。ftp クライアント (かわいい FTP) がランダムなポートを使用してディレクトリとファイルを一覧表示しているように見えますが、ここで接続が切断されました。資格情報を使用してログ接続を確認すると成功しますが、後でディレクトリを一覧表示するときに失敗して切断されます。FTPクライアントがランダムポートを使用して接続を成功させるDockerコンテナーでFTPサーバーをセットアップする方法を理解しようとしています。参考までに、PORT と PASIVE の両方の接続タイプを試しましたが、どちらも機能しませんでした。これが私のcuteftp接続ログです:

*** CuteFTP 8.0 - build Aug 22 2006 ***

STATUS:>    [2/13/2019 11:22:56 AM] Getting listing ""...
STATUS:>    [2/13/2019 11:22:56 AM] Resolving host name localhost...
STATUS:>    [2/13/2019 11:22:56 AM] Host name localhost resolved: ip = 127.0.0.1.
STATUS:>    [2/13/2019 11:22:56 AM] Connecting to FTP server... localhost:2121 (ip = 127.0.0.1)...
STATUS:>    [2/13/2019 11:22:56 AM] Socket connected. Waiting for welcome message...
        [2/13/2019 11:22:56 AM] 220 (vsFTPd 3.0.3)
STATUS:>    [2/13/2019 11:22:56 AM] Connected. Authenticating...
COMMAND:>   [2/13/2019 11:22:56 AM] USER ftpuser
        [2/13/2019 11:22:56 AM] 331 Please specify the password.
COMMAND:>   [2/13/2019 11:22:56 AM] PASS *****
        [2/13/2019 11:22:56 AM] 230 Login successful.
STATUS:>    [2/13/2019 11:22:56 AM] Login successful.
COMMAND:>   [2/13/2019 11:22:56 AM] PWD
        [2/13/2019 11:22:56 AM] 257 "/" is the current directory
STATUS:>    [2/13/2019 11:22:56 AM] Home directory: /
COMMAND:>   [2/13/2019 11:22:56 AM] FEAT
        [2/13/2019 11:22:56 AM] Informational Message Only:
        211-Features:
         EPRT
         EPSV
         MDTM
         PASV
         REST STREAM
         SIZE
         TVFS
        211 End
STATUS:>    [2/13/2019 11:22:56 AM] This site supports features.
STATUS:>    [2/13/2019 11:22:56 AM] This site supports SIZE.
STATUS:>    [2/13/2019 11:22:56 AM] This site can resume broken downloads.
COMMAND:>   [2/13/2019 11:22:56 AM] REST 0
        [2/13/2019 11:22:56 AM] 350 Restart position accepted (0).
COMMAND:>   [2/13/2019 11:22:56 AM] PASV
        [2/13/2019 11:22:56 AM] 227 Entering Passive Mode (172,17,0,2,202,168).
STATUS:>    [2/13/2019 11:22:56 AM] Substituting received PASV address 172.17.0.2 to server address 127.0.0.1.
COMMAND:>   [2/13/2019 11:22:56 AM] LIST
STATUS:>    [2/13/2019 11:22:56 AM] Connecting FTP data socket... 127.0.0.1:51880...
ERROR:>     [2/13/2019 11:22:57 AM] The remote host actively refused the attempt to connect to it.
        1) Verify that the destination server name or IP address is correct
        2) Verify that the connection port number is correct (under Site Settings | Type tab).
        3) The remote server may be temporarily or permanently inaccessible (try again later).
        4) Verify that you have chosen the right protocol (SSH2, SSL, FTP, etc.) and have setup all required options for that protocol.
        5) Verify that the destination IP address and port numbers are correct.
        6) The remote server may be refusing multiple connections from the same client. Try using only one connection thread when connecting to this particular server (Site Settings | Options).
        7) Try pinging the address.
        8) If you are using a router, verify the router is up and running (check by pinging it and then ping an address outside of the router).
        9) Do a traceroute to the destination to verify all routers along the connection path are operational.
        10) Verify that your subnet mask is setup properly.
        11) Verify that your local software or hardware firewall is not blocking outbound connections originating from CuteFTP.
        12) Verify that your anti-virus software is not at fault (try disabling it).
ERROR:>     [2/13/2019 11:22:57 AM] PASV failed, trying PORT.
STATUS:>    [2/13/2019 11:22:57 AM] Waiting 0 seconds...
STATUS:>    [2/13/2019 11:22:57 AM] Getting listing "/"...
STATUS:>    [2/13/2019 11:22:57 AM] Resolving host name localhost...
STATUS:>    [2/13/2019 11:22:57 AM] Host name localhost resolved: ip = 127.0.0.1.
STATUS:>    [2/13/2019 11:22:57 AM] Connecting to FTP server... localhost:2121 (ip = 127.0.0.1)...
STATUS:>    [2/13/2019 11:22:57 AM] Socket connected. Waiting for welcome message...
        [2/13/2019 11:22:57 AM] 220 (vsFTPd 3.0.3)
STATUS:>    [2/13/2019 11:22:57 AM] Connected. Authenticating...
COMMAND:>   [2/13/2019 11:22:57 AM] USER ftpuser
        [2/13/2019 11:22:57 AM] 331 Please specify the password.
COMMAND:>   [2/13/2019 11:22:57 AM] PASS *****
        [2/13/2019 11:22:57 AM] 230 Login successful.
STATUS:>    [2/13/2019 11:22:57 AM] Login successful.
COMMAND:>   [2/13/2019 11:22:57 AM] PWD
        [2/13/2019 11:22:57 AM] 257 "/" is the current directory
STATUS:>    [2/13/2019 11:22:57 AM] Home directory: /
STATUS:>    [2/13/2019 11:22:57 AM] This site supports features.
STATUS:>    [2/13/2019 11:22:57 AM] This site supports SIZE.
STATUS:>    [2/13/2019 11:22:57 AM] This site can resume broken downloads.
COMMAND:>   [2/13/2019 11:22:57 AM] REST 0
        [2/13/2019 11:22:57 AM] 350 Restart position accepted (0).
COMMAND:>   [2/13/2019 11:22:57 AM] PORT 127,0,0,1,205,112
        [2/13/2019 11:22:57 AM] 500 Illegal PORT command.
ERROR:>     [2/13/2019 11:22:57 AM] Syntax error: command unrecognized.
ERROR:>     [2/13/2019 11:22:57 AM] Failed to establish data socket.

次のコマンドを実行して、ubuntu コンテナーを起動しました

docker -dit --name ubuntu -p 80:80 -p 22:22 -p 21:21 ubuntu
docker exec -it ubuntu bash
apt update
apt install vfstpd

必要な変更を加えて vsftpd.conf を編集しました。cuteftp ログに基づいて、succefull 接続を取得していますが、cuteftp がセッションのランダム ポートを使用してファイルとディレクトリを表示しているため、ディレクトリとファイルは一覧表示されません。ポート 80、22、および 21 のみがコンテナーにマップされています。

ユースケースはありません。私はdockerが初めてで、遊んで学んでいます。ubuntuコンテナを実行してから、LAMPをインストールしたかったのです。私はLAMPのインストールに成功しましたが、ファイルをhtmlフォルダーにアップロードしてサイトをテストするためにFTPサーバーが必要でした。これはただの学習です。LAMPがすでにインストールされているdockerイメージを見つけることができることは知っていますが、それは学習していません。ubuntuコンテナの実行について質問があります。個別に質問し(別の質問)、誰かが回答するのを待っていると思います。

あなたの提案に従って、私は試しました

 docker run -dit --name ubuntu --network host ubuntu

そしてこれはうまくいきませんでした。コンテナーに SSH を実行することさえできなかったので、 --network host はすべてのポートをコンテナーに渡さなかったようです。

4

0 に答える 0