Dino Geek, try to help you

How to share files between a host and an LXC container?


1. You can share directories between host and container at the time of creating the container, with the help of -B option.

Here’s the command to bind /home/user on the host to /home/user in the container:

```
lxc-create -n myContainer -t download -B /home/user:/home/user
```
The above command and method may not work on all versions of LXC or distributions.

1. Another method to share a directory between host and LXC container is by bind mounting.

First, stop your container:

```
lxc-stop -n myContainer
```

Then add the following line to the config file found usually in /var/lib/lxc/myContainer/config:

```
lxc.mount.entry = /home/user home/user none bind 0 0
```
Then, start your container:

```
lxc-start -n myContainer
```
Now, /home/user in your LXC container is the same as /home/user on your host. Any changes on the host is seen inside the container and vice-versa.

Note: Always take a backup before making any changes to configuration files.


Simply generate articles to optimize your SEO
Simply generate articles to optimize your SEO





DinoGeek offers simple articles on complex technologies

Would you like to be quoted in this article? It's very simple, contact us at dino@eiki.fr

CSS | NodeJS | DNS | DMARC | MAPI | NNTP | htaccess | PHP | HTTPS | Drupal | WEB3 | LLM | Wordpress | TLD | Domain name | IMAP | TCP | NFT | MariaDB | FTP | Zigbee | NMAP | SNMP | SEO | E-Mail | LXC | HTTP | MangoDB | SFTP | RAG | SSH | HTML | ChatGPT API | OSPF | JavaScript | Docker | OpenVZ | ChatGPT | VPS | ZIMBRA | SPF | UDP | Joomla | IPV6 | BGP | Django | Reactjs | DKIM | VMWare | RSYNC | Python | TFTP | Webdav | FAAS | Apache | IPV4 | LDAP | POP3 | SMTP

| Whispers of love (API) | Déclaration d'Amour |






Legal Notice / General Conditions of Use