Question about cpu.limits


#1

Hello everybody,
at first please excuse my bad english and my maybe noobish question about this great project.
I made my very first steps with LXC and struggle about limiting ressources to a container.

Some background info:
My host system is a ubuntu 16.04 LTS virtualized by Hyper-V provided with 12 processors and 24 GB RAM.
The container is a very simple one like shown at LXC homepage section “getting started”.

Installed on the host system is just a desktop version of Ubuntu, SSH Server and lxc, lxc-client, htop,iftop,byobu. So you see, a very clean install.

Installed inside at the container is just a openssh-server. The commands my question is about, where made after starting a the container and after the container was stopped.

Now I tried to set limits by following this guide: https://www.jamescoyle.net/how-to/2532-setting-cpu-resource-limits-with-lxc

As you can see by the image attached the command finished by error: not found

grafik

I also tried this command at another server with a not virtualized environment, the same error message occured.

So my two questions I want to ask you are:
1.) Can you please help me to solve this issue and
2.) Please can you provide me some information about not using the config set command and putting these limit to the container config itself, but I was unable to find the config file where I can put limits.cpu in.

Thank you in advance ! And thanks for this great project!

Kind regards
Armin (Skyer)


#2

The command

lxc config set my-container limits.cpu 2

works only if you have a container that is really called my-container.
Do you have such a container?
Can you run lxc list and show as the output?

You can also edit the configuration of a container by running

 lxc config edit mycontainer 

You can see the configuration of the container mycontainer with

lxc config show mycontainer

#3

Hi simos,
thanks for your answer,
yes indeed I have a container called “my-container”.
The output by using your command lxc list does not show any entries, just an empty table, but by using sudo lxc-ls -f, I get this:

grafik

But other commands mentioned show and edit. ended with the same result : error: not found.

Following the “get started” documentiation, I did exactly each command, copying an editing the veths and config and adding uids.

Thanks in advance!
Armin


#4

My apologies then. Because you have correctly tagged this question as LXC. My comment and instructions were about using LXD. That lxc command that you used is part of LXD and cannot be used in LXC.

If you do not have a specific reason to use LXC, I suggest that you look into using LXD as it is simpler and more user-friendly than plain LXC. See more about the two at Comparing LXD vs. LXC

I am not familiar with LXC, therefore I cannot help you much with it.


#5

Ah that explains a lot for me, because I wondered because nobody seems to have the same problem. I will have an eye on lxd for sure!

Please does anybody else has an idea about my “issue”!

Best regards!
Armin