GithubHelp home page GithubHelp logo

clarence-pan / node-ftp-server-for-docker Goto Github PK

View Code? Open in Web Editor NEW
13.0 3.0 2.0 1.88 MB

A ftp server for docker - allow accessing files in docker containers even when container already started. Based on sh and docker cp

JavaScript 55.53% TypeScript 44.47%

node-ftp-server-for-docker's Introduction

Node FTP Server For Docker

这是一个 docker 专用的 FTP 服务器 - 允许通过 FTP 协议来访问 docker 容器中的文件(即使 docker 容器已经启动了也可以的哟)。基于 linux shell sh 和 docker 的 docker cp.

It is a ftp server for docker - allow accessing files in docker containers even when container already started. Based on sh and docker cp.

NPM version Stability build status Test coverage David deps Known Vulnerabilities NPM download

运行依赖 Requirements

  • Node.js 5.x Not tested
  • Node.js 6.x Tested
  • Node.js 7.x Not tested

安装 Install

npm install -g ftp-server-for-docker

运行 Run the server

示例 Example

localhost:21 上启动 FTP 服务器,并运行 test 用户通过密码 123456 来访问。

Start the FTP server on localhost:21 and allow user test access by password 123456

$ ftp-server-for-docker -H localhost -p 21 --users test:123456
FtpServer start listening at localhost:21

示例2 Example2

使用 ftp-server-for-docker 来浏览容器 wordpress 中的文件:

User ftp-server-for-docker to explore files in container wordpress:

查看命令行帮助 Find CLI help

$ ftp-server-for-docker --help
Usage: ftp-server-for-docker [options]

Options:
  --port, -p       Specify which port to listen on(default is 21)       [number]
  --host, -H       Specify which host to bind(default is 0.0.0.0)       [string]
  --annoymous, -a  Whether enable annoymous user                       [boolean]
  --users, -u      Specify users (in form like username:password, can be
                   multiple)                                             [array]
  --config, -c     Specify which configuration file to use
  --debug          Whether enable debug mode                           [boolean]
  -h, --help       Show help                                           [boolean]
  -?, --help       Show help                                           [boolean]

Examples:
  ftp-server-for-docker -h localhost -p 21  Start the FTP Server on
  -u test:123                               localhost:21, allow user `test` to
                                            access.

已知问题 Known Issues

  • windows 下中文目录/文件名会乱码
  • 被动模式传输有问题(建议切换到主动模式)

node-ftp-server-for-docker's People

Contributors

clarence-pan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

haveam iamnewsea

node-ftp-server-for-docker's Issues

ftp-server-for-docker crashed

`DJdeMacBook-Pro:~ dj$ ftp-server-for-docker -H localhost -p 21 --users test:123456
util.js:971
throw new TypeError('The super constructor to "inherits" must not ' +
^

TypeError: The super constructor to "inherits" must not be null or undefined
at Object.inherits (util.js:971:11)
at Object. (/usr/local/lib/node_modules/ftp-server-for-docker/node_modules/ftpd/lib/ftpd.js:67:6)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object. (/usr/local/lib/node_modules/ftp-server-for-docker/lib/ftp-server.js:5:14)
DJdeMacBook-Pro:~ dj$ npm -v
5.6.0
DJdeMacBook-Pro:~ dj$ node -v
v8.9.3
DJdeMacBook-Pro:~ dj$ `

it cannot show files

  docker-fs:debug readdir { path: '/' } +7ms                                                                 
  shell ShellExec: "docker" "ps" "--format" "{{.Names}}" +1ms                                                
  shell ["docker" "ps" "--format" "{{.Names}}"]: exit with code: 127 +4ms                                    
  shell ["docker" "ps" "--format" "{{.Names}}"]: end:                                                        
  shell STDOUT:                                                                                              
  shell                                                                                                      
  shell STDERR:                                                                                              
  shell /bin/sh: docker: command not found                                                                   
                                                                                                             
  shell    =>  { err:                                                                                        
   { Error: Command failed: "docker" "ps" "--format" "{{.Names}}"                                            
   /bin/sh: docker: command not found                                                                        
                                                                                                             
       at ChildProcess.exithandler (child_process.js:204:12)                                                 
       at emitTwo (events.js:106:13)                                                                         
       at ChildProcess.emit (events.js:191:7)                                                                
       at maybeClose (internal/child_process.js:886:16)                                                      
       at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)                              
     killed: false,                                                                                          
     code: 127,                                                                                              
     signal: null,                                                                                           
     cmd: '"docker" "ps" "--format" "{{.Names}}"' },                                                         
  retCode: 127 } +0ms                                                                                        
While sending file list, reading directory: Error: Command failed: "docker" "ps" "--format" "{{.Names}}"     
/bin/sh: docker: command not found                                                                           
                                                                                                             
FTP command: QUIT                                                                                            
Client connection ended                                                                                      
Client connection closed                                                                                     

npm version node-v6.10.1-linux-x64

ERR_INVALID_ARG_TYPE', 'superCtor'

ftp-server-for-docker -h localhost -p 21 -u test:123

util.js:948
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'superCtor', 'Function');
^

TypeError [ERR_INVALID_ARG_TYPE]: The "superCtor" argument must be of type Function
at Object.inherits (util.js:948:11)
at Object. (/usr/local/lib/node_modules/ftp-server-for-docker/node_modules/ftpd/lib/ftpd.js:67:6)
at Module._compile (module.js:649:30)
at Object.Module._extensions..js (module.js:

树莓派3b+运行出错,arm v7的架构

root@raspberrypi:~# ftp-server-for-docker -H localhost -p 21 --users abc:123456
ftp-server Listening on port 21 +0ms
FtpServer start listening at localhost:21
(node:4427) DeprecationWarning: process.EventEmitter is deprecated. Use require('events') instead.
ftp-server Ftp Server error: { Error: listen EADDRINUSE :::21
at Object.exports._errnoException (util.js:1020:11)
at exports._exceptionWithHostPort (util.js:1043:20)
at Server._listen2 (net.js:1271:14)
at listen (net.js:1307:10)
at Server.listen (net.js:1403:5)
at FtpServer.(anonymous function) [as listen] (/root/.nvm/versions/node/v6.15.1/lib/node_modules/ftp-server-for-docker/node_modules/ftpd/lib/ftpd.js:171:31)
at FtpServer.listen (/root/.nvm/versions/node/v6.15.1/lib/node_modules/ftp-server-for-docker/lib/ftp-server.js:98:19)
at runFtpServer (/root/.nvm/versions/node/v6.15.1/lib/node_modules/ftp-server-for-docker/lib/cli.js:13:10)
at Array.module.exports (/root/.nvm/versions/node/v6.15.1/lib/node_modules/ftp-server-for-docker/lib/cli.js:86:12)
at Object. (/root/.nvm/versions/node/v6.15.1/lib/node_modules/ftp-server-for-docker/cli.js:5:25)
code: 'EADDRINUSE',
errno: 'EADDRINUSE',
syscall: 'listen',
address: '::',
port: 21 } +29ms
FtpServer got error: { Error: listen EADDRINUSE :::21
at Object.exports._errnoException (util.js:1020:11)
at exports._exceptionWithHostPort (util.js:1043:20)
at Server._listen2 (net.js:1271:14)
at listen (net.js:1307:10)
at Server.listen (net.js:1403:5)
at FtpServer.(anonymous function) [as listen] (/root/.nvm/versions/node/v6.15.1/lib/node_modules/ftp-server-for-docker/node_modules/ftpd/lib/ftpd.js:171:31)
at FtpServer.listen (/root/.nvm/versions/node/v6.15.1/lib/node_modules/ftp-server-for-docker/lib/ftp-server.js:98:19)
at runFtpServer (/root/.nvm/versions/node/v6.15.1/lib/node_modules/ftp-server-for-docker/lib/cli.js:13:10)
at Array.module.exports (/root/.nvm/versions/node/v6.15.1/lib/node_modules/ftp-server-for-docker/lib/cli.js:86:12)
at Object. (/root/.nvm/versions/node/v6.15.1/lib/node_modules/ftp-server-for-docker/cli.js:5:25)
code: 'EADDRINUSE',
errno: 'EADDRINUSE',
syscall: 'listen',
address: '::',
port: 21 }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.