Oracle Linux Container LXC 7.3 on Oracle Linux 7.3

This article explains how to create a Linux Containers 7.3  LXC on Oracle Linux 7.x, while creating an interface network as a bridge with a dedicated network address.


  1. Install the pre-requis LXC container:
  2. Creation of Oracle Linux container 7u3.
  3. Set up a static IP address for Linux Container:

1. Install the pre-requis:

We have as a host, ORACLE Linux 7.3

# cat /etc/oracle-release
Oracle Linux Server release 7.3

# uname -a
Linux 3.8.13-118.16.3.el7uek.x86_64 #2 SMP Wed Feb 8 17:43:34 PST 2017 x86_64 x86_64 x86_64 GNU/Linux

a. Install the dedicated packages of the Linux containers.

Note: If  you want to Create the containers LXC on a File system BTRFS, then install the package btrfs-progs.

# yum install btrfs-progs lxc -y

Note: If you want to Create the containers LXC on a File system like XFS, then just install the package LXC because the File system XFS is built in Oracle Linux 7.x

# yum install lxc -y

b. Creation of the Filesystem container XFS.

Note: We can create btrfs file system on the disk and to use his feautures on cloning existing LXC container, but in my tutorial, I am going to use the filesystem XFS.

# fdisk /dev/sdb
# mkfs.xfs /dev/sdb1
# mount /dev/sdb1 /container

c. Sheck the Oracle Linux container templates:

The templates are located as script under the folder: /usr/share/lxc/templates

# ls /usr/share/lxc/templates
lxc-alpine     lxc-busybox  lxc-debian    lxc-gentoo        lxc-oracle  lxc-ubuntu
lxc-altlinux   lxc-centos   lxc-download  lxc-openmandriva  lxc-plamo   lxc-ubuntu-cloud
lxc-archlinux  lxc-cirros   lxc-fedora    lxc-opensuse      lxc-sshd

2. Creation of Oracle Linux container LXC 7u3:

Linux container creation requires the yum repository be available. I am going to use the public YUM repository.

  • container name:
  • template name: -t oracle
  • release name: –release 7.3

# lxc-create -n -t oracle -- --release=7.3
Rebuilding rpm database
Patching container rootfs /container/ for Oracle Linux 7.3
Configuring container for Oracle Linux 7.3
Added container user:oracle password:oracle
Added container user:root password:root
Container : /container/
Config    : /container/
Network   : eth0 (veth
veth) on lxcbr0

Note: After the creation of the Oracle Linux template the password of the user root is root and the user oracle is oracle as a password.

a. Verify the Configuration file of our container:

#cat /container/
# Template used to create this container: /usr/share/lxc/templates/lxc-oracle
# Parameters passed to the template: --release=7.3
# For additional config options, please look at lxc.container.conf(5) = veth = lxcbr0 = up = 00:16:3e:06:92:09
lxc.rootfs = /container/
# Common configuration
lxc.include = /usr/share/lxc/config/oracle.common.conf
# Container configuration for Oracle Linux 7.3
lxc.arch = x86_64
lxc.utsname =
lxc.cap.drop = sys_resource
# Networking = eth0 = 1500


b. Start / stop the container:

The option –name or -n to specify the container name.

lxc-start --name
# lxc-stop --name
# lxc-autostart -n

c. Connect to the container:

Method 1: Using the tool lxc-attach

# lxc-attach  -n

Method 2: Using the SSH connection after configuring the network, check next step.

3.  Set up a static IP address for Linux Container:

Notelxcbr0 – network bridge which was created automatically when the lxc tools have been installed.

a. I have chaged the bridge ip address to on /etc/sysconfig/lxc-net

#grep ^LXC /etc/sysconfig/lxc-net

b. Change the configuration file of the container: /container/

# Networking = veth = lxcbr0 = up = eth0 = 00:16:3e:3b:b8:50 = 1500 =

c. Adding an other bridge interface lxcbr1:

# brctl addbr lxcbr1
# ifconfig lxcbr1
# ifconfig lxcbr1
lxcbr1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet  netmask  broadcast
        inet6 fe80::a80d:ceff:feb9:f310  prefixlen 64  scopeid 0x20<link>
        ether aa:0d:ce:b9:f3:10  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 19  bytes 2957 (2.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


Creation of Oracle Linux 7.x container on the host Oracle Linux 7.3 and configuring the network connection.


Bookmark the permalink.
Loading Facebook Comments ...

One Response to Oracle Linux Container LXC 7.3 on Oracle Linux 7.3

  1. Pingback: Internet connection with a DHCP on my Oracle Linux LXC 7.3 – Wadhah DAOUEHI

Leave a Reply