lost and found ( for me ? )

create CentOS7 containers under Ubuntu 14.04 host

Here's how to create CentOS7 containers under Ubuntu 14.04 LXC host.

# apt-get install lxc lxc-templates yum

create a CentOS7 container.
root@ubuntu:~# /usr/share/lxc/templates/lxc-centos -n centos7-01 --release=7

change root password of the container.
root@ubuntu:~# chroot /var/lib/lxc/centos7-01/rootfs passwd
Changing password for user root.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.

run the container.
root@ubuntu:~# lxc-start -n centos7-01 -d

access to the container.
root@ubuntu:~# lxc-attach -n centos7-01
[root@centos7-01 ~]# cat /etc/centos-release
CentOS Linux release 7.2.1511 (Core)
[root@centos7-01 ~]# uname -ri
3.19.0-49-generic x86_64
[root@centos7-01 ~]# exit

I can not create a CentOS7 container with lxc-create.
lxc-create does not seem to pass ‘--release’ options.
root@ubuntu:~# lxc-create -t centos --release=7 -n centos7-02
lxc-create: unrecognized option '--release=7'
Usage: lxc-create --name=NAME -t template [-w] [-r] [-P lxcpath]

lxc-create creates a container

Options :
 -n, --name=NAME    NAME of the container
 -f, --config=file  Initial configuration file
 -t, --template=t   Template to use to setup container

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.