1

I have a running docker container with some service running inside it. Using that service, I want to pull a file from the host into the container.

  • docker cp won't work because that command is run from the host. I
    want to trigger the copy from the container

  • mounting host filesystem paths into the container is not possible without stopping the container. I cannot stop the container. I can, however, install other things inside this Ubuntu container

  • I am not sure scp is an option since I don't have the login/password/keys to the host from the running container

Is it even possible to pull/copy a file into a container from a service running inside the container? What are my possibilities here? ftp? telnet? What are my options?

Thanks

2
  • Netcat? You need to setup a few things though Commented Mar 15, 2018 at 8:22
  • How would netcat work? I always thought netcat requires action from the sending server. Eg: busylog.net/netcat-nc-for-file-transfer-and-other-example In my case, I want to do no action from the sending server (host) Commented Mar 15, 2018 at 8:44

2 Answers 2

1

I don't think you have many options. An idea is that if:

  • the host has a web server (or FTP server) up and running
  • and the file is located in the appropriate directory (so that it can be served)

maybe you can use wget or curl to get the file. Keep in mind that you might need credentials though...


IMHO, if what you are asking for is doable, it is a security hole.

Sign up to request clarification or add additional context in comments.

Comments

0

Pass the host path as a parameter to your docker container, customize the docker image to read the file from the path(read above in parameter) and use the file as required. You could validate the same in docker entry point script.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.