Docker - Create lnmp environment through Dockerfile and use Docker to quickly build sftp service

docker.io/atmoz/sftp

 

1. Install the docker environment

  See  http://www.cnblogs.com/rslai/p/8403350.html

2. Find sftp images from Docker Hub

docker search sftp

3. Install sftp - access via port forwarding

1. The sftp upload file directory is in the container

docker run -p 22:22 -d atmoz/sftp foo:pass:::upload
  • foo:pass:::upload where foo is the username, pass is the password, and upload is the uploaded file will be saved to the /home/foo/upload directory in the container
  • -p 22:22 maps the host's port 22 to the container's port 22, so that the host's 22 port will be forwarded to the container's port 22
  • -d atmoz/sftp Create a container using the atmoz/sftp image in the dockup hub

In the sftp container built by the above command, the files uploaded by the user will be stored in the container. If the container is deleted, the uploaded files will be lost.

2. The sftp upload file directory is in the host directory

, Through the following methods, you can share the local file system to the container, so that the uploaded files will be visible on the host. Even if the container is deleted, the uploaded files will not be lost.

3. Create a multi-user sftp service

All of the above only created the user foo in the container. What if there are multiple users who need to log in to sftp? See the example below:

Fourth, install sftp - direct ip access

 

  

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325253020&siteId=291194637