meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
linux:lxc [2016/04/26 09:21] niziaklinux:lxc [2020/09/07 19:01] (current) niziak
Line 91: Line 91:
 <file | local/share/lxc/oldgitlab/config> <file | local/share/lxc/oldgitlab/config>
 lxc.mount.entry = /host/some/folder container/folder none bind,create=dir,optional 0 0 lxc.mount.entry = /host/some/folder container/folder none bind,create=dir,optional 0 0
-</code>+</file>
  
 ===== Templates ===== ===== Templates =====
Line 211: Line 211:
 lxc.start.delay = 5 lxc.start.delay = 5
 lxc.start.order = 100 lxc.start.order = 100
 +lxc.group = onboot
 </file> </file>
 <code> <code>
Line 220: Line 221:
 Edit cron Edit cron
 <code bash>crontab -e</code> <code bash>crontab -e</code>
-<code>@reboot lxc-autostart</code>+<code>@reboot /usr/bin/lxc-autostart --all</code>
  
  
Line 230: Line 231:
 ... ...
 </file> </file>
 +
 +===== Limit resources =====
 +<file | config>
 +# 512MB memory limit, 256MB soft limie - system treats it as low mem condition
 +lxc.cgroup.memory.limit_in_bytes = 512M
 +lxc.cgroup.memory.soft_limit_in_bytes = 256M
 +# total usage memory (swap+ram) limit to 1G
 +lxc.cgroup.memory.memsw.limit_in_bytes = 1G
 +
 +# arbitary value which only sets relative priority between containers
 +lxc.cgroup.cpu.shares = 100
 +
 +# restrict to use cpu core 0 and 1
 +lxc.cgroup.cpuset.cpus 0,1
 +
 +lxc.cgroup.blkio.weight 500
 +</file>
 +
 +Limiting runtime:
 +<code bash>lxc-cgroup -n test-container cpu.shares 100</code>
 +
 +<file | ~/.local/share/lxc/gitlab/config>
 +</file>
 +==== ulimit change for unpriv container ====
 +Inside container, this command fails:
 +<code bash>ulimit -n 65536</code>
 +
 +
 +
 +
  
 ===== Debug ===== ===== Debug =====
Line 252: Line 283:
 lxc-start 1460629578.159 ERROR    lxc_start_ui - lxc_start.c:main:345 - Additional information can be obtained by setting the --logfile and --logpriority options. lxc-start 1460629578.159 ERROR    lxc_start_ui - lxc_start.c:main:345 - Additional information can be obtained by setting the --logfile and --logpriority options.
 </code> </code>
 +
 +Debug levels: ''FATAL ALERT CRIT ERROR WARN NOTICE INFO DEBUG TRACE'' \\
 +
 +Configure debug levels in config file:
 +  lxc.logfile
 +  lxc.loglevel
 +
  
 ===== Errors ===== ===== Errors =====
 +
 +==== Failed to load config for gitlab ====
 +
 +Error after system upgrade. LXC has been updated from 2.0.1 to v 3.0.1
 +
 +<code bash>
 +$ lxc-info gitlab
 +Failed to load config for gitlab
 +Failure to retrieve information on /home/lxcgitlab/.local/share/lxc:gitlab
 +</code>
 +
 +SOLUTION:
 +<code bash>
 +cd /home/lxcgitlab/.local/share/lxc/gitlab
 +lxc-update-config -c config
 +</code>
 +
 ==== Failed to mount cgroup ==== ==== Failed to mount cgroup ====
 <code> <code>