LoginSignup
6
4

More than 5 years have passed since last update.

dockerでpure-ftpdを立ち上げる

Last updated at Posted at 2018-10-26

諸事情でftp環境を作りたい事案が発生したので、dockerで使えるpure-ftpdを試した記録。

docker version

$ docker -v
Docker version 18.06.1-ce, build e68fc7a

stilliard/pure-ftpd

特にこだわりは無いのでサクッとしらべて出てきたこれを使う。

マウントするFTP用のディレクトリを用意

$ mkdir ./volume
$ echo "hello ftp" > volume/test.txt

dockerでftpdを起動する

ホストのvolumeディレクトリをマウントして、exampleというユーザでFTPにアクセスできるようにする。

docker run \
    -d \
    --rm \
    --name ftpd \
    -p 21:21 \
    -p 30000-30009:30000-30009 \
    -e "PUBLICHOST=localhost" \
    -e "FTP_USER_NAME=example" \
    -e "FTP_USER_PASS=example" \
    -e "FTP_USER_HOME=/home/example" \
    -v $(pwd)/volume:/home/example \
    stilliard/pure-ftpd

テストしてみる

MacのFinderでftp://localhost:21に接続。

image.png

認証を要求されるので設定したアカウントでログインする。

image.png

作成したテスト用のファイルが見れるようになった。

image.png

お手軽。

6
4
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
4