{"id":1342,"date":"2024-07-23T12:36:26","date_gmt":"2024-07-23T12:36:26","guid":{"rendered":"https:\/\/dockerpros.com\/?post_type=glossary&#038;p=1342"},"modified":"2024-07-23T12:36:26","modified_gmt":"2024-07-23T12:36:26","slug":"dockerfile-cpuset-cpus","status":"publish","type":"glossary","link":"https:\/\/dockerpros.com\/fr\/wiki\/dockerfile-cpuset-cpus\/","title":{"rendered":"Dockerfile \u2013cpuset-cpus"},"content":{"rendered":"<h1>Comprendre l'option \u2013cpuset-cpus du Dockerfile : Perspectives avanc\u00e9es\n\nL'option \u2013cpuset-cpus du Dockerfile est un param\u00e8tre puissant qui permet de contr\u00f4ler l'affinit\u00e9 des processeurs pour les conteneurs Docker. Cette fonctionnalit\u00e9 est particuli\u00e8rement utile dans les environnements multi-tenant ou lors de l'ex\u00e9cution d'applications gourmandes en ressources, o\u00f9 il est crucial d'optimiser l'utilisation du CPU.\n\nLorsque vous utilisez l'option \u2013cpuset-cpus, vous sp\u00e9cifiez quels c\u0153urs de CPU sont disponibles pour un conteneur particulier. Par exemple, si vous avez un syst\u00e8me \u00e0 8 c\u0153urs et que vous d\u00e9finissez \u2013cpuset-cpus=\"0-3\", le conteneur ne pourra utiliser que les quatre premiers c\u0153urs. Cette isolation garantit que les processus du conteneur ne perturbent pas les performances des autres conteneurs ou du syst\u00e8me h\u00f4te.\n\nIl est important de noter que l'option \u2013cpuset-cpus fonctionne en conjonction avec d'autres param\u00e8tres de gestion des ressources, tels que \u2013cpus ou \u2013memory. En combinant ces options, vous pouvez cr\u00e9er un environnement de conteneurisation hautement optimis\u00e9 et s\u00e9curis\u00e9.\n\nUn cas d'utilisation courant de \u2013cpuset-cpus est dans les environnements de conteneurs o\u00f9 vous avez des applications sensibles \u00e0 la latence, comme les bases de donn\u00e9es ou les syst\u00e8mes de traitement en temps r\u00e9el. En affectant des c\u0153urs de CPU sp\u00e9cifiques \u00e0 ces conteneurs, vous pouvez minimiser les interruptions et garantir des performances constantes.\n\nUn autre avantage de l'utilisation de \u2013cpuset-cpus est la possibilit\u00e9 de cr\u00e9er des topologies de CPU personnalis\u00e9es. Par exemple, vous pouvez r\u00e9server certains c\u0153urs pour des t\u00e2ches critiques et allouer d'autres c\u0153urs \u00e0 des conteneurs moins sensibles. Cette flexibilit\u00e9 vous permet d'adapter l'utilisation du CPU en fonction des besoins sp\u00e9cifiques de vos applications.\n\nCependant, il est crucial de comprendre que l'utilisation incorrecte de \u2013cpuset-cpus peut entra\u00eener une sous-utilisation des ressources CPU. Si vous d\u00e9finissez trop peu de c\u0153urs pour un conteneur, il peut ne pas \u00eatre en mesure de g\u00e9rer efficacement sa charge de travail. \u00c0 l'inverse, si vous allouez trop de c\u0153urs, vous risquez de priver d'autres conteneurs des ressources n\u00e9cessaires.\n\nPour optimiser l'utilisation de \u2013cpuset-cpus, il est recommand\u00e9 de surveiller attentivement les performances de vos conteneurs et d'ajuster les param\u00e8tres en cons\u00e9quence. Des outils comme Docker stats ou des solutions de monitoring plus avanc\u00e9es peuvent vous aider \u00e0 identifier les goulots d'\u00e9tranglement et \u00e0 r\u00e9partir les ressources de mani\u00e8re plus efficace.\n\nEn conclusion, l'option \u2013cpuset-cpus du Dockerfile est un outil puissant pour contr\u00f4ler l'affinit\u00e9 des processeurs dans les environnements conteneuris\u00e9s. En comprenant son fonctionnement et en l'utilisant judicieusement, vous pouvez cr\u00e9er des d\u00e9ploiements Docker plus efficaces, s\u00e9curis\u00e9s et adapt\u00e9s aux besoins sp\u00e9cifiques de vos applications.<\/h1>\n<p>Lors du d\u00e9ploiement d'applications dans des conteneurs, les performances et l'allocation des ressources sont des aspects critiques qui peuvent influencer de mani\u00e8re significative l'efficacit\u00e9 et la r\u00e9activit\u00e9 de vos applications. Une fonctionnalit\u00e9 puissante de Docker qui aide \u00e0 la gestion des ressources est la <code>--cpuset-cpus<\/code> option. This flag allows developers to specify which CPU cores a <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\" target=\"_blank\">conteneur<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Containers are lightweight, portable units that encapsulate software and its dependencies, enabling consistent execution across different environments. They leverage OS-level virtualization for efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> peut s'ex\u00e9cuter sur, am\u00e9liorant le contr\u00f4le de la r\u00e9partition des ressources, optimisant les performances et g\u00e9rant les contentions dans les environnements multi-locataires. Dans cet article, nous plongerons en profondeur dans le <code>--cpuset-cpus<\/code> option, its practical applications, implications on performance, and strategies for effective use.<\/p>\n<h2>Qu'est-ce que <code>--cpuset-cpus<\/code>?<\/h2>\n<p><code>--cpuset-cpus<\/code> is a Docker runtime flag that can be included in the <code>docker <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/run\/\" target=\"_blank\">run<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">\"RUN\" refers to a command in various programming languages and operating systems to execute a specified program or script. It initiates processes, providing a controlled environment for task execution.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span><\/code> command or specified in a <span class=\"glossaryai-tooltip glossary-term-689\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/docker-compose-file\/\" target=\"_blank\">fichier Docker Compose<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Un fichier Docker Compose est un fichier de configuration YAML qui d\u00e9finit les services, les r\u00e9seaux et les volumes pour les applications Docker multi-conteneurs. Il simplifie le d\u00e9ploiement et la gestion, am\u00e9liorant ainsi l'efficacit\u00e9.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/docker-compose-file\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>. It restricts the execution of <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\" target=\"_blank\">conteneur<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Containers are lightweight, portable units that encapsulate software and its dependencies, enabling consistent execution across different environments. They leverage OS-level virtualization for efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> processes to a specific set of CPU cores, leveraging the underlying Linux kernel&#8217;s CPU affinity feature. By design, this allows Docker users to allocate CPU resources more granularly, catering to specific workloads and improving performance by minimizing CPU contention among containers.<\/p>\n<h2>La n\u00e9cessit\u00e9 de l'affinit\u00e9 CPU dans la conteneurisation<\/h2>\n<p>In traditional environments, applications <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/run\/\" target=\"_blank\">run<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">\"RUN\" refers to a command in various programming languages and operating systems to execute a specified program or script. It initiates processes, providing a controlled environment for task execution.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> on a single operating system instance, vying for CPU resources as required. The advent of containerization brought about a paradigm shift, enabling multiple isolated applications to <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/run\/\" target=\"_blank\">run<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">\"RUN\" refers to a command in various programming languages and operating systems to execute a specified program or script. It initiates processes, providing a controlled environment for task execution.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> on the same kernel. However, this multi-tenancy has its drawbacks, particularly regarding resource contention. Containers may compete for CPU cycles, leading to unpredictable performance.<\/p>\n<p>To address these concerns, Docker provides mechanisms like CPU shares, limits, and reservations. Among these, <code>--cpuset-cpus<\/code> gives a fine-grained approach to control which CPUs can be utilized by a specific <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\" target=\"_blank\">conteneur<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Containers are lightweight, portable units that encapsulate software and its dependencies, enabling consistent execution across different environments. They leverage OS-level virtualization for efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>. This is particularly useful in scenarios where performance predictability is paramount, such as high-frequency trading applications, real-time data processing, or applications heavily reliant on CPU-bound operations.<\/p>\n<h2>The Syntax of <code>--cpuset-cpus<\/code><\/h2>\n<p>The syntax for using the <code>--cpuset-cpus<\/code> L'option est simple. Elle peut \u00eatre incluse dans vos commandes Docker comme suit :<\/p>\n<pre><code class=\"language-bash\">docker run --cpuset-cpus=\"0,1\" my-container<\/code><\/pre>\n<p>In this example, the <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\" target=\"_blank\">conteneur<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Containers are lightweight, portable units that encapsulate software and its dependencies, enabling consistent execution across different environments. They leverage OS-level virtualization for efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> <code>my-container<\/code> is restricted to <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/run\/\" target=\"_blank\">run<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">\"RUN\" refers to a command in various programming languages and operating systems to execute a specified program or script. It initiates processes, providing a controlled environment for task execution.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> only on CPU cores 0 and 1. You can specify a range of CPUs using a hyphen, such as:<\/p>\n<pre><code class=\"language-bash\">docker run --cpuset-cpus=\"0-2\" my-container<\/code><\/pre>\n<p>This would allow the <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\" target=\"_blank\">conteneur<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Containers are lightweight, portable units that encapsulate software and its dependencies, enabling consistent execution across different environments. They leverage OS-level virtualization for efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> to execute on CPU cores 0, 1, and 2. Furthermore, you can combine ranges and individual CPUs:<\/p>\n<pre><code class=\"language-bash\">docker run --cpuset-cpus=\"0,2-4\" mon-conteneur<\/code><\/pre>\n<p>In this instance, the <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\" target=\"_blank\">conteneur<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Containers are lightweight, portable units that encapsulate software and its dependencies, enabling consistent execution across different environments. They leverage OS-level virtualization for efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> can <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/run\/\" target=\"_blank\">run<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">\"RUN\" refers to a command in various programming languages and operating systems to execute a specified program or script. It initiates processes, providing a controlled environment for task execution.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> on CPU cores 0, 2, 3, 4.<\/p>\n<h2>Quand l'utiliser <code>--cpuset-cpus<\/code><\/h2>\n<h3>Optimisation des performances<\/h3>\n<p>In environments where performance is critical, such as gaming servers, video encoding, or complex computations, restricting <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\" target=\"_blank\">conteneur<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Containers are lightweight, portable units that encapsulate software and its dependencies, enabling consistent execution across different environments. They leverage OS-level virtualization for efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> execution to specific CPUs can lead to significant improvements. By dedicating certain cores to specific containers, you can reduce the overhead of CPU context switching and cache misses, which are often detrimental to performance.<\/p>\n<h3>Resource Isolation<\/h3>\n<p>When running multiple containers on a single host, it&#8217;s essential to ensure that one <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\" target=\"_blank\">conteneur<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Containers are lightweight, portable units that encapsulate software and its dependencies, enabling consistent execution across different environments. They leverage OS-level virtualization for efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> does not starve others of resources. By using <code>--cpuset-cpus<\/code>, you can isolate CPU resources for different containers, ensuring that they do not interfere with each other&#8217;s performance. This is especially important in multi-tenant applications where different teams may <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/run\/\" target=\"_blank\">run<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">\"RUN\" refers to a command in various programming languages and operating systems to execute a specified program or script. It initiates processes, providing a controlled environment for task execution.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> their services on shared infrastructure.<\/p>\n<h3>Performance pr\u00e9visible<\/h3>\n<p>For applications that require predictable performance, assigning specific CPUs ensures that the <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\" target=\"_blank\">conteneur<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Containers are lightweight, portable units that encapsulate software and its dependencies, enabling consistent execution across different environments. They leverage OS-level virtualization for efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> will always execute on the same cores, reducing variability in performance metrics. This is particularly valuable in environments where <span class=\"glossaryai-tooltip glossary-term-681\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/service\/\" target=\"_blank\">Service<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Le service fait r\u00e9f\u00e9rence \u00e0 l'acte de fournir une assistance ou un soutien pour r\u00e9pondre \u00e0 des besoins ou des exigences sp\u00e9cifiques. Dans divers domaines, il englobe le service client, le support technique et les services professionnels, en mettant l'accent sur l'efficacit\u00e9 et la satisfaction de l'utilisateur.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/service\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> Level Agreements (SLAs) demand consistent response times or throughput.<\/p>\n<h3>Informatique haute performance (High-Performance Computing, HPC)<\/h3>\n<p>In HPC scenarios, workloads are often tightly coupled with specific hardware capabilities. By using <code>--cpuset-cpus<\/code>, you can pin applications to specific CPU cores that may have higher clock speeds or are less loaded with other tasks, thereby maximizing computational efficiency.<\/p>\n<h2>How <code>--cpuset-cpus<\/code> Interagit avec d'autres fonctionnalit\u00e9s de gestion des ressources Docker<\/h2>\n<p>Docker fournit plusieurs options de gestion des ressources qui peuvent \u00eatre utilis\u00e9es en conjonction avec <code>--cpuset-cpus<\/code>. Understanding how these features interact can help you create more effective <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\" target=\"_blank\">conteneur<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Containers are lightweight, portable units that encapsulate software and its dependencies, enabling consistent execution across different environments. They leverage OS-level virtualization for efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> configurations.<\/p>\n<h3>CPU Shares<\/h3>\n<p>CPU shares (<code>--cpu-shares<\/code>) vous permettent de d\u00e9finir un poids relatif pour l'allocation du CPU. Si plusieurs conteneurs sont en cours d'ex\u00e9cution et se disputent le CPU, Docker allouera du temps CPU en fonction des parts attribu\u00e9es. Bien que <code>--cpuset-cpus<\/code> restricts which CPUs a <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\" target=\"_blank\">conteneur<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Containers are lightweight, portable units that encapsulate software and its dependencies, enabling consistent execution across different environments. They leverage OS-level virtualization for efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> can <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/run\/\" target=\"_blank\">run<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">\"RUN\" refers to a command in various programming languages and operating systems to execute a specified program or script. It initiates processes, providing a controlled environment for task execution.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> on, CPU shares dictate how much time it gets on those CPUs.<\/p>\n<p>Par exemple :<\/p>\n<pre><code class=\"language-bash\">docker run --cpuset-cpus=\"0,1\" --cpu-shares=512 my-container<\/code><\/pre>\n<p>Dans cette commande, <code>my-container<\/code> can only <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/run\/\" target=\"_blank\">run<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">\"RUN\" refers to a command in various programming languages and operating systems to execute a specified program or script. It initiates processes, providing a controlled environment for task execution.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> on CPU cores 0 and 1, but it has a relative share of 512 in comparison to other containers that may have different shares.<\/p>\n<h3>Quotas et limites du processeur\n\nLes quotas et les limites du processeur sont des concepts importants dans le domaine de l'informatique et de la gestion des ressources syst\u00e8me. Ils permettent de contr\u00f4ler et d'optimiser l'utilisation du processeur dans divers environnements, tels que les serveurs, les syst\u00e8mes d'exploitation et les environnements virtualis\u00e9s.\n\nUn quota de processeur est une limite impos\u00e9e sur la quantit\u00e9 de temps processeur qu'un processus ou un utilisateur peut consommer sur une p\u00e9riode donn\u00e9e. Cela permet d'\u00e9viter qu'un seul processus ou utilisateur monopolise les ressources du syst\u00e8me et garantit une r\u00e9partition \u00e9quitable du temps processeur entre tous les utilisateurs et processus.\n\nLes limites du processeur, quant \u00e0 elles, d\u00e9finissent la quantit\u00e9 maximale de temps processeur qu'un processus ou un utilisateur peut utiliser \u00e0 tout moment. Contrairement aux quotas, qui sont g\u00e9n\u00e9ralement appliqu\u00e9s sur une p\u00e9riode plus longue, les limites sont imm\u00e9diates et peuvent \u00eatre utilis\u00e9es pour pr\u00e9venir les pics de consommation de ressources qui pourraient affecter les performances du syst\u00e8me.\n\nDans les environnements virtualis\u00e9s, les quotas et les limites du processeur sont particuli\u00e8rement importants. Ils permettent aux administrateurs de r\u00e9partir efficacement les ressources processeur entre les diff\u00e9rentes machines virtuelles h\u00e9berg\u00e9es sur un m\u00eame serveur physique. Cela garantit que chaque machine virtuelle dispose d'une quantit\u00e9 suffisante de ressources processeur pour fonctionner correctement, tout en \u00e9vitant qu'une seule machine virtuelle ne consomme toutes les ressources disponibles.\n\nLes quotas et les limites du processeur peuvent \u00eatre configur\u00e9s de diff\u00e9rentes mani\u00e8res, selon le syst\u00e8me d'exploitation ou la plateforme de virtualisation utilis\u00e9e. Par exemple, dans les syst\u00e8mes Linux, des outils tels que cgroups (control groups) permettent de d\u00e9finir des limites de ressources, y compris des quotas et des limites de processeur, pour des groupes de processus.\n\nDans les environnements de conteneurs, tels que Docker, les quotas et les limites du processeur sont \u00e9galement essentiels. Ils permettent de contr\u00f4ler la quantit\u00e9 de ressources processeur allou\u00e9e \u00e0 chaque conteneur, garantissant ainsi que les applications s'ex\u00e9cutant dans les conteneurs ne consomment pas excessivement de ressources processeur et n'affectent pas les performances des autres conteneurs ou du syst\u00e8me h\u00f4te.\n\nIl est important de noter que la mise en place de quotas et de limites de processeur appropri\u00e9s n\u00e9cessite une compr\u00e9hension approfondie des besoins en ressources des applications et des charges de travail ex\u00e9cut\u00e9es sur le syst\u00e8me. Des quotas et des limites mal configur\u00e9s peuvent entra\u00eener des performances sous-optimales ou m\u00eame des d\u00e9faillances du syst\u00e8me.\n\nEn conclusion, les quotas et les limites du processeur sont des outils essentiels pour la gestion efficace des ressources processeur dans les syst\u00e8mes informatiques modernes. Ils permettent d'assurer une r\u00e9partition \u00e9quitable des ressources, d'optimiser les performances du syst\u00e8me et de pr\u00e9venir les probl\u00e8mes li\u00e9s \u00e0 la surconsommation de ressources processeur.<\/h3>\n<p>Docker also allows you to set quotas and limits. You can use <code>--cpu-quota<\/code> and <code>--processeurs<\/code> to set hard limits on the CPU time allocated to a <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\" target=\"_blank\">conteneur<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Containers are lightweight, portable units that encapsulate software and its dependencies, enabling consistent execution across different environments. They leverage OS-level virtualization for efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>. For instance:<\/p>\n<pre><code class=\"language-bash\">docker run --cpuset-cpus=\"0,1\" --cpus=\"1.5\" my-container<\/code><\/pre>\n<p>In this case, <code>my-container<\/code> can <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/run\/\" target=\"_blank\">run<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">\"RUN\" refers to a command in various programming languages and operating systems to execute a specified program or script. It initiates processes, providing a controlled environment for task execution.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> on CPUs 0 and 1, but it is limited to 1.5 CPUs worth of processing power. This means that the <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\" target=\"_blank\">conteneur<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Containers are lightweight, portable units that encapsulate software and its dependencies, enabling consistent execution across different environments. They leverage OS-level virtualization for efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> can utilize 150% of a single CPU&#8217;s capacity on average.<\/p>\n<h3>Contraintes de m\u00e9moire<\/h3>\n<p>It\u2019s worth noting that CPU management does not exist in a vacuum; memory allocation also plays a significant role in <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\" target=\"_blank\">conteneur<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Containers are lightweight, portable units that encapsulate software and its dependencies, enabling consistent execution across different environments. They leverage OS-level virtualization for efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> performance. Specifying limits on memory can prevent containers from consuming all available memory, which can lead to excessive swapping and poor performance.<\/p>\n<h2>Exemple pratique : optimisation d'une application web\n\nSuppose you have a web application that is experiencing performance issues. You can use the following steps to optimize it:\n\n1. Profiling: Use a profiling tool to identify the bottlenecks in your application. This will help you understand which parts of your code are taking the most time to execute.\n\n2. Caching: Implement caching mechanisms to store frequently accessed data in memory. This can significantly reduce the number of database queries and improve response times.\n\n3. Database optimization: Optimize your database queries by using indexes, reducing the number of joins, and minimizing the amount of data retrieved.\n\n4. Code optimization: Review your code for any inefficiencies or unnecessary computations. Look for opportunities to refactor and simplify your code.\n\n5. Load balancing: If your application is receiving a high volume of traffic, consider implementing load balancing to distribute the load across multiple servers.\n\n6. Content delivery network (CDN): Use a CDN to serve static assets like images, CSS, and JavaScript files from servers closer to the user's location. This can reduce latency and improve page load times.\n\n7. Minification and compression: Minify and compress your HTML, CSS, and JavaScript files to reduce their size and improve download times.\n\n8. Asynchronous processing: Offload time-consuming tasks to background processes or use asynchronous programming techniques to improve the responsiveness of your application.\n\n9. Monitoring and logging: Implement monitoring and logging to track the performance of your application over time. This will help you identify any regressions or new bottlenecks that may arise.\n\nBy following these steps and continuously monitoring and optimizing your application, you can significantly improve its performance and provide a better user experience.<\/h2>\n<p>Pour illustrer comment <code>--cpuset-cpus<\/code> can enhance performance, let\u2019s consider an example where we deploy a web application using Docker. Assume that we have two services: a web server (Nginx) and a database (PostgreSQL).<\/p>\n<h3>Configuration du sc\u00e9nario<\/h3>\n<p>In a typical deployment, we may want the web server to handle incoming requests quickly while ensuring the database remains responsive. We would like to allocate:<\/p>\n<ul>\n<li>4 c\u0153urs CPU pour Nginx<\/li>\n<li>2 CPU cores for PostgreSQL<\/li>\n<\/ul>\n<h3>Docker Compose Configuration<\/h3>\n<pre><code class=\"language-yaml\">version: '3.8'\nservices:\n  web:\n    image: nginx\n    cpuset: \"0-3\"        # Nginx can use CPUs 0, 1, 2, 3\n    deploy:\n      resources:\n        limits:\n          cpus: '4'      # Limit to 4 CPU cores\n\n  db:\n    image: postgres\n    cpuset: \"4,5\"        # PostgreSQL can use CPUs 4, 5\n    deploy:\n      resources:\n        limits:\n          cpus: '2'      # Limit to 2 CPU cores<\/code><\/pre>\n<h3>Analysis of Performance<\/h3>\n<p>Dans cette configuration, Nginx peut traiter les requ\u00eates entrantes sur quatre c\u0153urs de CPU d\u00e9di\u00e9s, tandis que PostgreSQL est limit\u00e9 \u00e0 ses deux propres c\u0153urs. Cette disposition permet de r\u00e9duire la concurrence des ressources, ce qui am\u00e9liore les temps de r\u00e9ponse pour les requ\u00eates web et acc\u00e9l\u00e8re les requ\u00eates de base de donn\u00e9es. <\/p>\n<p>Now, if under heavy load, both services start using their allocated resources, you can monitor performance using tools like <code>docker stats<\/code> pour observer l'utilisation du CPU et \u00e9valuer si l'allocation des ressources r\u00e9pond aux attentes de performance.<\/p>\n<h2>Considerations and Best Practices<\/h2>\n<p>En utilisant <code>--cpuset-cpus<\/code> offers significant advantages, there are several considerations and best practices to keep in mind:<\/p>\n<ol>\n<li>\n<p><strong>\u00c9valuer les caract\u00e9ristiques de la charge de travail<\/strong>: Avant d'affecter les c\u0153urs de processeur, analysez les caract\u00e9ristiques de la charge de travail et d\u00e9terminez si une affinit\u00e9 CPU sp\u00e9cifique donnera effectivement des r\u00e9sultats b\u00e9n\u00e9fiques.<\/p>\n<\/li>\n<li>\n<p><strong>Monitor Performance<\/strong>Surveillez en continu les performances de vos conteneurs. Utilisez des outils comme Prometheus et Grafana pour visualiser l'utilisation du processeur et identifier les goulots d'\u00e9tranglement potentiels.<\/p>\n<\/li>\n<li>\n<p><strong>\u00c9viter la surpartition<\/strong>: Une restriction excessive des ressources CPU peut entra\u00eener une sous-utilisation. Assurez-vous de laisser une certaine marge pour tenir compte des pics de besoins en ressources.<\/p>\n<\/li>\n<li>\n<p><strong>Test and Iterate<\/strong>: Mettez en \u0153uvre les modifications dans un environnement de pr\u00e9production avant de les d\u00e9ployer en production. L'optimisation des performances est souvent un processus it\u00e9ratif, et des ajustements peuvent \u00eatre n\u00e9cessaires au fil du temps.<\/p>\n<\/li>\n<li>\n<p><strong>Utilisation avec d'autres fonctionnalit\u00e9s de gestion des ressources<\/strong>: Combiner <code>--cpuset-cpus<\/code> with CPU shares, quotas, and memory limits for a more holistic resource management strategy.<\/p>\n<\/li>\n<li>\n<p><strong>Consid\u00e9rer les param\u00e8tres du noyau<\/strong>: Advanced users may want to explore kernel parameters like <code>cgroups<\/code> to further refine resource allocation for Docker containers.<\/p>\n<\/li>\n<\/ol>\n<h2>Conclusion<\/h2>\n<p>The <code>--cpuset-cpus<\/code> option in Docker is a powerful tool for optimizing resource allocation and ensuring predictable performance of containerized applications. By providing the ability to restrict CPU usage to specific cores, developers can improve responsiveness, isolate workloads, and fine-tune their applications for maximum efficiency.<\/p>\n<p>As <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\" target=\"_blank\">conteneur<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Containers are lightweight, portable units that encapsulate software and its dependencies, enabling consistent execution across different environments. They leverage OS-level virtualization for efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> <span class=\"glossaryai-tooltip glossary-term-657\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/orchestration\/\" target=\"_blank\">orchestration<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">L'orchestration d\u00e9signe la gestion et la coordination automatis\u00e9es de syst\u00e8mes et de services complexes. Elle optimise les processus en int\u00e9grant diverses composantes, en garantissant un fonctionnement efficace et une utilisation optimale des ressources.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/orchestration\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> continue d'\u00e9voluer, en comprenant et en exploitant les fonctionnalit\u00e9s de gestion des ressources comme <code>--cpuset-cpus<\/code> will be essential for creating robust, high-performance applications in cloud-native environments. By following best practices and continuously monitoring performance, you can make informed decisions that enhance your <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\" target=\"_blank\">conteneur<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Containers are lightweight, portable units that encapsulate software and its dependencies, enabling consistent execution across different environments. They leverage OS-level virtualization for efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> deployments and ultimately improve user experience.<\/p>","protected":false},"excerpt":{"rendered":"<p>L'option `\u2013cpuset-cpus` dans Docker permet aux utilisateurs de sp\u00e9cifier quels c\u0153urs CPU un <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\" target=\"_blank\">conteneur<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Containers are lightweight, portable units that encapsulate software and its dependencies, enabling consistent execution across different environments. They leverage OS-level virtualization for efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> peut utiliser. Cette fonctionnalit\u00e9 am\u00e9liore les performances et la gestion des ressources en limitant les ressources CPU \u00e0 des c\u0153urs d\u00e9sign\u00e9s, am\u00e9liorant ainsi l'efficacit\u00e9 dans les syst\u00e8mes multi-c\u0153urs.<\/p>","protected":false},"author":1,"featured_media":1997,"parent":0,"template":"","glossary-cat":[],"class_list":["post-1342","glossary","type-glossary","status-publish","has-post-thumbnail","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Dockerfile -cpuset-cpus - Dockerpros<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/dockerpros.com\/fr\/wiki\/dockerfile-cpuset-cpus\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Dockerfile -cpuset-cpus - Dockerpros\" \/>\n<meta property=\"og:description\" content=\"The `--cpuset-cpus` option in Docker allows users to specify which CPU cores a container can utilize. This feature enhances performance and resource management by limiting CPU resources to designated cores, improving efficiency in multi-core systems.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/dockerpros.com\/fr\/wiki\/dockerfile-cpuset-cpus\/\" \/>\n<meta property=\"og:site_name\" content=\"Dockerpros\" \/>\n<meta property=\"og:image\" content=\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/dockerfile-cpuset-cpus_1342.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"600\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Dur\u00e9e de lecture estim\u00e9e\" \/>\n\t<meta name=\"twitter:data1\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/dockerpros.com\/de\/wiki\/dockerfile-cpu-set-cpus\/\",\"url\":\"https:\/\/dockerpros.com\/de\/wiki\/dockerfile-cpu-set-cpus\/\",\"name\":\"Dockerfile -cpuset-cpus - Dockerpros\",\"isPartOf\":{\"@id\":\"https:\/\/dockerpros.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/dockerpros.com\/de\/wiki\/dockerfile-cpu-set-cpus\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/dockerpros.com\/de\/wiki\/dockerfile-cpu-set-cpus\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/dockerfile-cpuset-cpus_1342.jpg\",\"datePublished\":\"2024-07-23T12:36:26+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/dockerpros.com\/de\/wiki\/dockerfile-cpu-set-cpus\/#breadcrumb\"},\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/dockerpros.com\/de\/wiki\/dockerfile-cpu-set-cpus\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\/\/dockerpros.com\/de\/wiki\/dockerfile-cpu-set-cpus\/#primaryimage\",\"url\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/dockerfile-cpuset-cpus_1342.jpg\",\"contentUrl\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/dockerfile-cpuset-cpus_1342.jpg\",\"width\":800,\"height\":600,\"caption\":\"dockerfile-cpuset-cpus-2\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/dockerpros.com\/de\/wiki\/dockerfile-cpu-set-cpus\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/dockerpros.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Glossary\",\"item\":\"https:\/\/dockerpros.com\/fr\/wiki\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Dockerfile &#8211;cpuset-cpus\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/dockerpros.com\/#website\",\"url\":\"https:\/\/dockerpros.com\/\",\"name\":\"Dockerpros\",\"description\":\"DockerPros \u2013 Your Ultimate Docker Resource Hub\",\"publisher\":{\"@id\":\"https:\/\/dockerpros.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/dockerpros.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"fr-FR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/dockerpros.com\/#organization\",\"name\":\"Dockerpros\",\"url\":\"https:\/\/dockerpros.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\/\/dockerpros.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/Dockerpros_logo_blanco.png\",\"contentUrl\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/Dockerpros_logo_blanco.png\",\"width\":532,\"height\":114,\"caption\":\"Dockerpros\"},\"image\":{\"@id\":\"https:\/\/dockerpros.com\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Dockerfile -cpuset-cpus - Dockerpros","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/dockerpros.com\/fr\/wiki\/dockerfile-cpuset-cpus\/","og_locale":"fr_FR","og_type":"article","og_title":"Dockerfile -cpuset-cpus - Dockerpros","og_description":"The `--cpuset-cpus` option in Docker allows users to specify which CPU cores a container can utilize. This feature enhances performance and resource management by limiting CPU resources to designated cores, improving efficiency in multi-core systems.","og_url":"https:\/\/dockerpros.com\/fr\/wiki\/dockerfile-cpuset-cpus\/","og_site_name":"Dockerpros","og_image":[{"width":800,"height":600,"url":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/dockerfile-cpuset-cpus_1342.jpg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_misc":{"Dur\u00e9e de lecture estim\u00e9e":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/dockerpros.com\/de\/wiki\/dockerfile-cpu-set-cpus\/","url":"https:\/\/dockerpros.com\/de\/wiki\/dockerfile-cpu-set-cpus\/","name":"Dockerfile -cpuset-cpus - Dockerpros","isPartOf":{"@id":"https:\/\/dockerpros.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/dockerpros.com\/de\/wiki\/dockerfile-cpu-set-cpus\/#primaryimage"},"image":{"@id":"https:\/\/dockerpros.com\/de\/wiki\/dockerfile-cpu-set-cpus\/#primaryimage"},"thumbnailUrl":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/dockerfile-cpuset-cpus_1342.jpg","datePublished":"2024-07-23T12:36:26+00:00","breadcrumb":{"@id":"https:\/\/dockerpros.com\/de\/wiki\/dockerfile-cpu-set-cpus\/#breadcrumb"},"inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/dockerpros.com\/de\/wiki\/dockerfile-cpu-set-cpus\/"]}]},{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/dockerpros.com\/de\/wiki\/dockerfile-cpu-set-cpus\/#primaryimage","url":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/dockerfile-cpuset-cpus_1342.jpg","contentUrl":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/dockerfile-cpuset-cpus_1342.jpg","width":800,"height":600,"caption":"dockerfile-cpuset-cpus-2"},{"@type":"BreadcrumbList","@id":"https:\/\/dockerpros.com\/de\/wiki\/dockerfile-cpu-set-cpus\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/dockerpros.com\/"},{"@type":"ListItem","position":2,"name":"Glossary","item":"https:\/\/dockerpros.com\/fr\/wiki\/"},{"@type":"ListItem","position":3,"name":"Dockerfile &#8211;cpuset-cpus"}]},{"@type":"WebSite","@id":"https:\/\/dockerpros.com\/#website","url":"https:\/\/dockerpros.com\/","name":"Dockerpros","description":"DockerPros \u2013 Votre centre de ressources Docker incontournable","publisher":{"@id":"https:\/\/dockerpros.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/dockerpros.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"fr-FR"},{"@type":"Organization","@id":"https:\/\/dockerpros.com\/#organization","name":"Dockerpros","url":"https:\/\/dockerpros.com\/","logo":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/dockerpros.com\/#\/schema\/logo\/image\/","url":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/Dockerpros_logo_blanco.png","contentUrl":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/Dockerpros_logo_blanco.png","width":532,"height":114,"caption":"Dockerpros"},"image":{"@id":"https:\/\/dockerpros.com\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/glossary\/1342","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/glossary"}],"about":[{"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/types\/glossary"}],"author":[{"embeddable":true,"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/users\/1"}],"version-history":[{"count":0,"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/glossary\/1342\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/media\/1997"}],"wp:attachment":[{"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/media?parent=1342"}],"wp:term":[{"taxonomy":"glossary-cat","embeddable":true,"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/glossary-cat?post=1342"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}