Difference between revisions of "LXC Ubuntu 16.04"

From MyWiki
Jump to: navigation, search
Line 11: Line 11:
 
autostarting containers - https://www.cyberciti.biz/faq/how-to-auto-start-lxd-containers-at-boot-time-in-linux/
 
autostarting containers - https://www.cyberciti.biz/faq/how-to-auto-start-lxd-containers-at-boot-time-in-linux/
 
  lxc launch images:centos/7 centos
 
  lxc launch images:centos/7 centos
 +
</source>
 +
 +
Give static ip address to containers in modern version of lxd
 +
<source lang="text">
 +
 +
lxc stop c1
 +
lxc network attach lxdbr0 c1 eth0 eth0
 +
lxc config device set c1 eth0 ipv4.address 10.99.10.42
 +
lxc start c1
 +
 
</source>
 
</source>

Revision as of 12:30, 2 December 2018

https://tutorials.ubuntu.com/tutorial/tutorial-setting-up-lxd-1604#2

There are two repositories -    images repository  and  ubuntu repository
lxc image list images:
lxc image list ubuntu:
https://www.youtube.com/watch?v=snWp-5K2LO4
lxc exec first -- /bin/bash
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to [DestinationIP:PORT]
iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 587 -j DNAT  --to-destination 10.0.3.100:587
To set static ip addresses - https://medium.com/@ali_oguzhan/lxd-assigning-static-ip-to-containers-ecf558982071
autostarting containers - https://www.cyberciti.biz/faq/how-to-auto-start-lxd-containers-at-boot-time-in-linux/
 lxc launch images:centos/7 centos

Give static ip address to containers in modern version of lxd

lxc stop c1
lxc network attach lxdbr0 c1 eth0 eth0
lxc config device set c1 eth0 ipv4.address 10.99.10.42
lxc start c1