2

With lxc1, lxd and lxd-client installed I can launch a ubuntu based container with

lxc launch --profile default ubuntu:18.04 c1

I was wondering if it is also possible to lauch a container based on CentOS. I tried several options centos:7, centos:7.4 etc but it seems that such a box is not available.

When I execute sudo lxc-create -n c1 -t download I see many options including CentOS but that is LXC. Or more or less expect LXD to have the same or even more options.

Does LXD have a CentOS template? Can I reuse a LXC template? How do you create a CentOS based LXD container?

onknows
  • 877

1 Answers1

3

Well - ubuntu is the image server, not the OS... as counter intuitive as it is.

lxc remote list will give you a list of enabled remote servers


+-----------------+------------------------------------------+---------------+-------------+--------+--------+
|      NAME       |                   URL                    |   PROTOCOL    |  AUTH TYPE  | PUBLIC | STATIC |
+-----------------+------------------------------------------+---------------+-------------+--------+--------+
| images          | https://images.linuxcontainers.org       | simplestreams | none        | YES    | NO     |
+-----------------+------------------------------------------+---------------+-------------+--------+--------+
| local (default) | unix://                                  | lxd           | file access | NO     | YES    |
+-----------------+------------------------------------------+---------------+-------------+--------+--------+
| ubuntu          | https://cloud-images.ubuntu.com/releases | simplestreams | none        | YES    | YES    |
+-----------------+------------------------------------------+---------------+-------------+--------+--------+
| ubuntu-daily    | https://cloud-images.ubuntu.com/daily    | simplestreams | none        | YES    | YES    |
+-----------------+------------------------------------------+---------------+-------------+--------+--------+

Most guides assume you're using the images remote server

You'd need the images remote server - most guides assume that you are using the ubuntu remote server - hence the "ubuntu:version" syntax

You can search for centos images, in the images remote with lxc image list images:centos

This will give you the listing of everything that's centos - something like


+----------------------------------+--------------+--------+------------------------------------------+--------------+-----------------+----------+-------------------------------+
|              ALIAS               | FINGERPRINT  | PUBLIC |               DESCRIPTION                | ARCHITECTURE |      TYPE       |   SIZE   |          UPLOAD DATE          |
+----------------------------------+--------------+--------+------------------------------------------+--------------+-----------------+----------+-------------------------------+
| centos/6 (3 more)                | fa76b2602447 | yes    | Centos 6 amd64 (20201119_07:08)          | x86_64       | CONTAINER       | 75.79MB  | Nov 19, 2020 at 12:00am (UTC) |
+----------------------------------+--------------+--------+------------------------------------------+--------------+-----------------+----------+-------------------------------+
| centos/6/cloud (1 more)          | 606ddaf55044 | yes    | Centos 6 amd64 (20201119_07:08)          | x86_64       | CONTAINER       | 84.11MB  | Nov 19, 2020 at 12:00am (UTC) |
+----------------------------------+--------------+--------+------------------------------------------+--------------+-----------------+----------+-------------------------------+
| centos/6/cloud/i386              | 999be8e85790 | yes    | Centos 6 i386 (20201119_07:08)           | i686         | CONTAINER       | 84.25MB  | Nov 19, 2020 at 12:00am (UTC) |
+----------------------------------+--------------+--------+------------------------------------------+--------------+-----------------+----------+-------------------------------+
| centos/6/i386 (1 more)           | 543d3d8c6640 | yes    | Centos 6 i386 (20201119_07:08)           | i686         | CONTAINER       | 75.93MB  | Nov 19, 2020 at 12:00am (UTC) |

Lets say I wanted a plain vanilla centos/6 AMD64 container

lxc init images:centos/6 test would work.

You can then start up and work on your centos container.

I found this page pretty helpful in working out and understanding the commands, though I had to do a little poking around to find out where centos was

Journeyman Geek
  • 133,878