简体   繁体   English

FTP文件到远程服务器上的docker容器中

[英]FTP file into docker container on remote server

How can I transfer transfer files into a Docker container running on a remote Ubuntu server using an FTP client? 如何使用FTP客户端将传输文件传输到在远程Ubuntu服务器上运行的Docker容器中? I can SSH into the server and use docker cp , which works fine. 我可以SSH到服务器并使用docker cp ,这很好。 But I have a client who needs to be able to do so with something like FileZilla. 但我有一个客户需要能够使用像FileZilla这样的东西。 Is this possible? 这可能吗?

Im not an expert with docker, but you could try this: 我不是docker的专家,但你可以试试这个:

You can expose several ports when you run the container. 运行容器时可以显示多个端口。 So, you can expose the FTP port also, something like this. 所以,你也可以暴露FTP端口,就像这样。

docker run --name containername -p 3000:80 -p 3001:21 -d dockerimagename

In this example with the -p 3001:21 you are exposing your port 21 of the container to your port 3001 of the Server, so you can enter with filezilla with the ip of your server for host, and 3001 as port. 在这个使用-p 3001:21示例中,您将容器的端口21暴露给服务器的端口3001,因此您可以使用服务器的ip输入filezilla作为主机,输入3001作为端口。

You should not transfer files into a running container image. 您不应将文件传输到正在运行的容器映像中。 It's a really bad idea. 这是一个非常糟糕的主意。

Containers come and go all the time, most container orchestrators auto-restart containers, so the files you upload will be wiped as the container restarts cleanly form its original image. 容器随时都有出现,大多数容器协调器会自动重启容器,因此当容器从原始映像中干净地重新启动时,上载的文件将被擦除。

Best-practice: Rebuild and redeploy the container image every time you need to make a change to a production application running inside a container. 最佳实践:每次需要对容器内运行的生产应用程序进行更改时,重新构建并重新部署容器映像。

If you need for testing purposes: Docker containers don't expose a FTP server, because containers are supposed to run only 1 process (ie your ENTRYPOINT application). 如果您需要进行测试: Docker容器不会公开FTP服务器,因为容器应该只运行1个进程(即您的ENTRYPOINT应用程序)。 However, you can use commands like docker cp to copy files from/to running containers. 但是,您可以使用docker cp类的命令将文件复制到正在运行的容器中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法在 docker 容器中运行的远程 Jupyter 服务器上保存文件 - Can't save file on remote Jupyter server running in docker container 如何将文件从远程服务器的docker容器复制到本地机器 - How to copy file from docker container of remote server to local machine Docker 容器中的 FTP 上传文件失败 - FTP upload file failed in Docker container 在 docker 容器中运行的 Spring 批处理将文件从 docker 容器中写入 - 直接发送到 SFTP 远程服务器 - Spring batch running in a docker container to Write file out of the docker container - directly to the SFTP remote server VS Code:在远程服务器中连接一个 docker 容器 - VS Code: connect a docker container in a remote server 远程访问在docker容器上运行的mysql服务器 - Remote accessing mysql server running on docker container 无法在Docker容器中使用远程Mysql Server登录 - Unable to login with Remote Mysql Server in docker container 将 docker 容器应用程序连接到远程数据库服务器 - Connecting docker container application to remote database server 如何连接远程docker容器mysql服务器 - how to connect remote docker container mysql server 如何在远程 ubuntu 服务器上部署 docker 容器? - How to deploy a docker container on a remote ubuntu server?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM