4

I'm new to containers. I have a LXC container running on a remote linux machine. All I found online is how to copy files from host to LXC container. But how can I copy files from a running LXC container to the host, and eventually to my own machine?

Maybe it seems trivial that I couldn't find anything. I'm new and am a bit confused.

1

3 Answers 3

3

Install a SSH server on your LXC container. Allow connections from remote hosts to port TCP 22. From your own machine connect to your LXC container using SCP with WinSCP (for Windows). In case you are using Linux on your own machine just use the scp command from console.

1
  • You are unnecesarily exposing SSH service in your container. See my comment in the OP question. Commented Jun 8, 2018 at 4:31
2

Use lxc file pull

lxc file pull [<remote>:]<instance>/<path> [[<remote>:]<instance>/<path>...] <target path> [flags]
1
  • 3
    It is important to note that this functionality is not actually part of LXC but of LXD.
    – Daniel B
    Commented Dec 4, 2022 at 10:31
1

I can do it the other way around. So SCP a local folder on the LXC container to the host machine:

scp -r /root/[container folder] [email protected]:/root/[host folder to put files in]
1
  • 10.0.3.1 is the interface IP shown on the host.
    – Tina J
    Commented Nov 13, 2017 at 18:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .