Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
ssh-keygen -R remote-server-name-here 

 

Share Folders with Host

... (this will be moved into a separate article)

Warning

Crap... I got this working late one night and don't remember the steps now.... below steps are not quite correct... will have to reverse engineer what I got working...

Think basic steps are,

  1. make top level directory on host, /opt/lxc
  2. go into container and create the directory ie mkdir /opt/confluence-share-data as whatever user you need in this case serveradmin
  3. shutdown container
  4. modify config of container, 
    1. lxc.mount.entry = /opt/lxc/confluence-share-data /var/lib/lxc/t01app/rootfs/opt/confluence-share-data none bind.rw 0.0
    2. Note that you never create the confluence-share-data folder in the host just the lxc folder
  5. Bootup container and it will create in the host the folder /opt/lxc/confluence-share-data if it does not already exist

 

In this example, we want to mount a shared directory from the host system to be accessible to one or more containers,

Panel
host directory = /opt/lxc/confluenceshared-share-datafor-my-container/movies
the container, the directory = /opt/mount-host/movies

You may actually use the same directory name and path for both host and container, but I have kept them different for clarity.

While in the lxc container, create your directory and setup any permission you may want to set and shutdown the container,

Code Block
languagebash
cd /opt
sudo mkdir mount-host
sudo chown serveradmin:staff # make accessible to the serveradmin user and staff group
sudo shutdown -h now # shutdown the container

In the host either create the folder (you may use any user because root is the process accessing), but I use sudo. Note the folder you choose may also be a mount over a network share.

From the host modify the config files. In this example it is /var/lib/lxc/my-container/config and add the following line,

...