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.

Tina J
  • 579

3 Answers3

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.

2

Use lxc file pull

lxc file pull [<remote>:]<instance>/<path> [[<remote>:]<instance>/<path>...] <target path> [flags]
norq
  • 332
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] root@10.0.3.1:/root/[host folder to put files in]
Tina J
  • 579