亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

annuaire recherche
Compose About versions and upgrading (Compose) ASP.NET Core + SQL Server on Linux (Compose) CLI environment variables (Compose) Command-line completion (Compose) Compose(組成) Compose command-line reference(組合命令行參考) Control startup order (Compose) Django and PostgreSQL (Compose) Docker stacks and distributed application bundles (Compose) docker-compose build(docker-compose構建) docker-compose bundle docker-compose config docker-compose create docker-compose down docker-compose events docker-compose exec docker-compose help docker-compose images docker-compose kill docker-compose logs docker-compose pause docker-compose port docker-compose ps docker-compose pull docker-compose push docker-compose restart docker-compose rm docker-compose run docker-compose scale docker-compose start docker-compose stop docker-compose top docker-compose unpause docker-compose up Environment file (Compose) Environment variables in Compose Extend services in Compose Frequently asked questions (Compose) Getting started (Compose) Install Compose Link environment variables (deprecated) (Compose) Networking in Compose Overview of Docker Compose Overview of docker-compose CLI Quickstart: Compose and WordPress Rails and PostgreSQL (Compose) Sample apps with Compose Using Compose in production Using Compose with Swarm Engine .NET Core application (Engine) About images, containers, and storage drivers (Engine) Add nodes to the swarm (Engine) Apply custom metadata (Engine) Apply rolling updates (Engine) apt-cacher-ng Best practices for writing Dockerfiles (Engine) Binaries (Engine) Bind container ports to the host (Engine) Breaking changes (Engine) Build your own bridge (Engine) Configure container DNS (Engine) Configure container DNS in user-defined networks (Engine) CouchDB (Engine) Create a base image (Engine) Create a swarm (Engine) Customize the docker0 bridge (Engine) Debian (Engine) Default bridge network Delete the service (Engine) Deploy a service (Engine) Deploy services to a swarm (Engine) Deprecated Engine features Docker container networking (Engine) Docker overview (Engine) Docker run reference (Engine) Dockerfile reference (Engine) Dockerize an application Drain a node (Engine) Engine FAQ (Engine) Fedora (Engine) Get started (Engine) Get started with macvlan network driver (Engine) Get started with multi-host networking (Engine) How nodes work (Engine) How services work (Engine) Image management (Engine) Inspect the service (Engine) Install Docker (Engine) IPv6 with Docker (Engine) Join nodes to a swarm (Engine) Legacy container links (Engine) Lock your swarm (Engine) Manage nodes in a swarm (Engine) Manage sensitive data with Docker secrets (Engine) Manage swarm security with PKI (Engine) Manage swarm service networks (Engine) Migrate to Engine 1.10 Optional Linux post-installation steps (Engine) Overview (Engine) PostgreSQL (Engine) Raft consensus in swarm mode (Engine) Riak (Engine) Run Docker Engine in swarm mode Scale the service (Engine) SDKs (Engine) Select a storage driver (Engine) Set up for the tutorial (Engine) SSHd (Engine) Storage driver overview (Engine) Store service configuration data (Engine) Swarm administration guide (Engine) Swarm mode key concepts (Engine) Swarm mode overlay network security model (Engine) Swarm mode overview (Engine) Understand container communication (Engine) Use multi-stage builds (Engine) Use swarm mode routing mesh (Engine) Use the AUFS storage driver (Engine) Use the Btrfs storage driver (Engine) Use the Device mapper storage driver (Engine) Use the OverlayFS storage driver (Engine) Use the VFS storage driver (Engine) Use the ZFS storage driver (Engine) Engine: Admin Guide Amazon CloudWatch logs logging driver (Engine) Bind mounts (Engine) Collect Docker metrics with Prometheus (Engine) Configuring and running Docker (Engine) Configuring logging drivers (Engine) Control and configure Docker with systemd (Engine) ETW logging driver (Engine) Fluentd logging driver (Engine) Format command and log output (Engine) Google Cloud logging driver (Engine) Graylog Extended Format (GELF) logging driver (Engine) Journald logging driver (Engine) JSON File logging driver (Engine) Keep containers alive during daemon downtime (Engine) Limit a container's resources (Engine) Link via an ambassador container (Engine) Log tags for logging driver (Engine) Logentries logging driver (Engine) PowerShell DSC usage (Engine) Prune unused Docker objects (Engine) Run multiple services in a container (Engine) Runtime metrics (Engine) Splunk logging driver (Engine) Start containers automatically (Engine) Storage overview (Engine) Syslog logging driver (Engine) tmpfs mounts Troubleshoot volume problems (Engine) Use a logging driver plugin (Engine) Using Ansible (Engine) Using Chef (Engine) Using Puppet (Engine) View a container's logs (Engine) Volumes (Engine) Engine: CLI Daemon CLI reference (dockerd) (Engine) docker docker attach docker build docker checkpoint docker checkpoint create docker checkpoint ls docker checkpoint rm docker commit docker config docker config create docker config inspect docker config ls docker config rm docker container docker container attach docker container commit docker container cp docker container create docker container diff docker container exec docker container export docker container inspect docker container kill docker container logs docker container ls docker container pause docker container port docker container prune docker container rename docker container restart docker container rm docker container run docker container start docker container stats docker container stop docker container top docker container unpause docker container update docker container wait docker cp docker create docker deploy docker diff docker events docker exec docker export docker history docker image docker image build docker image history docker image import docker image inspect docker image load docker image ls docker image prune docker image pull docker image push docker image rm docker image save docker image tag docker images docker import docker info docker inspect docker kill docker load docker login docker logout docker logs docker network docker network connect docker network create docker network disconnect docker network inspect docker network ls docker network prune docker network rm docker node docker node demote docker node inspect docker node ls docker node promote docker node ps docker node rm docker node update docker pause docker plugin docker plugin create docker plugin disable docker plugin enable docker plugin inspect docker plugin install docker plugin ls docker plugin push docker plugin rm docker plugin set docker plugin upgrade docker port docker ps docker pull docker push docker rename docker restart docker rm docker rmi docker run docker save docker search docker secret docker secret create docker secret inspect docker secret ls docker secret rm docker service docker service create docker service inspect docker service logs docker service ls docker service ps docker service rm docker service scale docker service update docker stack docker stack deploy docker stack ls docker stack ps docker stack rm docker stack services docker start docker stats docker stop docker swarm docker swarm ca docker swarm init docker swarm join docker swarm join-token docker swarm leave docker swarm unlock docker swarm unlock-key docker swarm update docker system docker system df docker system events docker system info docker system prune docker tag docker top docker unpause docker update docker version docker volume docker volume create docker volume inspect docker volume ls docker volume prune docker volume rm docker wait Use the Docker command line (Engine) Engine: Extend Access authorization plugin (Engine) Docker log driver plugins Docker network driver plugins (Engine) Extending Engine with plugins Managed plugin system (Engine) Plugin configuration (Engine) Plugins API (Engine) Volume plugins (Engine) Engine: Security AppArmor security profiles for Docker (Engine) Automation with content trust (Engine) Content trust in Docker (Engine) Delegations for content trust (Engine) Deploying Notary (Engine) Docker security (Engine) Docker security non-events (Engine) Isolate containers with a user namespace (Engine) Manage keys for content trust (Engine) Play in a content trust sandbox (Engine) Protect the Docker daemon socket (Engine) Seccomp security profiles for Docker (Engine) Secure Engine Use trusted images Using certificates for repository client verification (Engine) Engine: Tutorials Engine tutorials Network containers (Engine) Get Started Part 1: Orientation Part 2: Containers Part 3: Services Part 4: Swarms Part 5: Stacks Part 6: Deploy your app Machine Amazon Web Services (Machine) Digital Ocean (Machine) docker-machine active docker-machine config docker-machine create docker-machine env docker-machine help docker-machine inspect docker-machine ip docker-machine kill docker-machine ls docker-machine provision docker-machine regenerate-certs docker-machine restart docker-machine rm docker-machine scp docker-machine ssh docker-machine start docker-machine status docker-machine stop docker-machine upgrade docker-machine url Driver options and operating system defaults (Machine) Drivers overview (Machine) Exoscale (Machine) Generic (Machine) Get started with a local VM (Machine) Google Compute Engine (Machine) IBM Softlayer (Machine) Install Machine Machine Machine CLI overview Machine command-line completion Machine concepts and help Machine overview Microsoft Azure (Machine) Microsoft Hyper-V (Machine) Migrate from Boot2Docker to Machine OpenStack (Machine) Oracle VirtualBox (Machine) Provision AWS EC2 instances (Machine) Provision Digital Ocean Droplets (Machine) Provision hosts in the cloud (Machine) Rackspace (Machine) VMware Fusion (Machine) VMware vCloud Air (Machine) VMware vSphere (Machine) Notary Client configuration (Notary) Common Server and signer configurations (Notary) Getting started with Notary Notary changelog Notary configuration files Running a Notary service Server configuration (Notary) Signer configuration (Notary) Understand the service architecture (Notary) Use the Notary client
personnages

默認情況下,容器沒有資源約束,并且可以使用主機內核調度器允許的給定資源的多少。Docker提供了控制容器可以使用多少內存、CPU或塊IO的方法,并設置docker run命令。本節(jié)詳細介紹了何時設置這些限制以及設置這些限制可能帶來的影響。

記憶

了解內存不足的風險

重要的是不要讓正在運行的容器占用主機的太多內存。在linux主機上,如果內核檢測到?jīng)]有足夠的內存來執(zhí)行重要的系統(tǒng)功能,則會拋出OOME,或Out Of Memory Exception,并開始銷毀進程以釋放內存。任何程序都可能被殺死,包括Docker和其他重要的應用程序。如果錯誤的過程被扼殺,這將有效地降低整個系統(tǒng)。

Docker試圖通過調整Docker守護進程上的OOM優(yōu)先級來降低這些風險,這樣它就不會比系統(tǒng)上的其他進程被殺死的可能性更小。不調整容器的OOM優(yōu)先級。這使得單個容器更有可能被殺死,而不是Docker守護進程或其他系統(tǒng)進程被殺死。您不應該試圖通過手動設置來規(guī)避這些安全措施。--oom-score-adj在守護進程或容器上,或通過設置--oom-disable-kill在集裝箱上。

有關Linux內核的OOM管理的更多信息,請參閱內存不足管理。

您可以通過以下方法減少由于OOME而導致的系統(tǒng)不穩(wěn)定風險:

  • 在將應用程序投入生產(chǎn)之前,執(zhí)行測試以了解應用程序的內存需求。

  • 確保您的應用程序僅在資源充足的主機上運行。

  • 限制容器可以使用的內存量,如下所述。

  • 在您的Docker主機上配置交換時要注意。交換比內存慢,性能差,但可以提供緩沖,防止系統(tǒng)內存不足。

  • 考慮將容器轉換為服務,并使用服務級約束和節(jié)點標簽確保應用程序僅在內存充足的主機上運行。

限制容器對內存的訪問

Docker可以強制執(zhí)行硬內存限制,這允許容器使用不超過給定數(shù)量的用戶或系統(tǒng)內存,或者軟限制,允許容器使用它所需要的內存,除非滿足某些條件。例如,當內核檢測到主機上的低內存或爭用時。當單獨使用或設置多個選項時,這些選項中的一些具有不同的效果。

大部分的選項取正整數(shù),跟著一個后綴b,km,g,,表示字節(jié),千字節(jié),兆字節(jié)或千兆字節(jié)。

選項

描述

-m or --memory=

容器可以使用的最大內存量。如果您設置此選項,則允許的最小值為4米(4兆字節(jié))。

--memory-swap*

此容器允許交換到磁盤的內存量。請參閱--memory-swap詳細信息。

--memory-swappiness

默認情況下,主機內核可以交換容器使用的匿名頁面的百分比。您可以將--memory-swappiness設置為介于0和100之間的值,以調整此百分比。請參閱--memory-swappiness詳細信息。

--memory-reservation

允許您指定一個小于--memory的軟限制,當Docker檢測到主機上的爭用或內存不足時,該內存會被激活。如果使用--memory-reservation,它必須設置為低于--memory才能優(yōu)先。由于這是一個軟限制,它不能保證容器不會超出限制。

--kernel-memory

容器可以使用的最大內核內存量。允許的最小值是4米。由于內核內存不能被換出,因此內核內存不足的容器可能會阻塞主機資源,這會對主機和其他容器產(chǎn)生副作用。請參閱 - 內核內存細節(jié)。

--oom-kill-disable

默認情況下,如果發(fā)生內存不足(OOM)錯誤,內核會殺死容器中的進程。要更改此行為,請使用--oom-kill-disable選項。只有在您還設置了-m /  -  memory選項的容器上禁用OOM殺手。如果未設置-m標志,主機可能會耗盡內存,內核可能需要終止主機系統(tǒng)的進程以釋放內存。

有關cgroup和內存的詳細信息,請參閱內存資源控制器...

--memory-swap細節(jié)

--memory-swap是一個修飾符標志,它只有在以下情況下才有意義:--memory也設置好了。當容器耗盡了可用的所有RAM時,使用交換空間允許容器將多余的內存需求寫入磁盤。對于經(jīng)常將內存交換到磁盤的應用程序,存在性能損失。

它的設置可能會產(chǎn)生復雜的影響:

  • 如果--memory-swap設置為正整數(shù),則兩者均為--memory--memory-swap必須設置好。--memory-swap表示可以使用的內存和交換空間的總量,以及--memory控制非交換內存使用的數(shù)量。所以如果--memory="300m"--memory-swap="1g",該容器可使用300 m內存和700 m%28。1g - 300m%29掉期

  • 如果--memory-swap設置為0,則忽略該設置,并將該值視為未設置。

  • 如果--memory-swap設置為與--memory,和--memory被設置為正整數(shù),容器將無法訪問交換。.見防止容器使用交換...

  • 如果--memory-swap是未設置的,而且--memory設置后,容器可以使用的交換空間是--memory設置,如果主機容器已配置了交換內存。例如,如果--memory="300m"--memory-swap如果沒有設置,容器可以使用300米內存和600米交換。

  • 如果--memory-swap顯式設置為-1,容器可以使用無限交換,最多可在主機系統(tǒng)上使用。防止容器使用交換如果--memory--memory-swap設置為相同的值,這將防止容器使用任何交換。這是因為--memory-swap是可以使用的組合內存和交換空間的數(shù)量,而--memory僅為可使用的物理內存量。--memory-swappiness細節(jié)

  • 值0關閉匿名頁交換。

  • 值100將所有匿名頁面設置為可交換。

  • 默認情況下,如果不設置--memory-swappiness,則從主機繼承該值。

--kernel-memory細節(jié)

內核內存限制以分配給容器的總體內存表示??紤]以下情況:

  • 無限內存,無限內核內存這是默認行為。

  • 無限內存,有限內核內存當所有cgroup所需的內存量大于主機上實際存在的內存量時,這是適當?shù)?。您可以將內核內存配置為永遠不要檢查主機上可用的內容,需要更多內存的容器需要等待。

  • 有限內存,無限制內核內存:總體內存是有限的,但是內核內存不是。

  • 有限內存,有限內核內存限制用戶和內核內存對于調試與內存相關的問題非常有用。如果容器使用的內存類型都是意外的,那么它將耗盡內存,而不會影響其他容器或主機。在此設置中,如果內核內存限制低于用戶內存限制,內核內存不足將導致容器遇到OOM錯誤。如果內核內存限制高于用戶內存限制,內核限制將不會導致容器體驗OOM。

當您打開任何內核內存限制時,主機會在每個進程的基礎上跟蹤“高水標記”統(tǒng)計數(shù)據(jù),這樣您就可以跟蹤哪個進程%28--在這種情況下,容器%29使用的是多余內存。這可以通過查看每個進程來查看。/proc/<PID>/status在主機上。

cpu

默認情況下,每個容器對主機CPU周期的訪問是無限的。您可以設置各種約束來限制給定容器對主機CPU周期的訪問。大多數(shù)用戶將使用和配置默認CFS調度程序.在Docker 1.13及更高版本中,還可以配置實時調度器...

配置默認的cfs調度程序

CFS是用于正常Linux進程的Linux內核CPU調度程序。幾個運行時標志允許您配置容器對CPU資源的訪問量。使用這些設置時,Docker將修改主機上容器的cgroup設置。

選項

描述

--cpus=<value>

指定容器可以使用多少可用CPU資源。例如,如果主機有兩個CPU,并且您設置了--cpus =“1.5”,那么該容器將保證最多可以訪問一個半的CPU。這相當于設置--cpu-period =“100000”和--cpu-quota =“150000”。在Docker 1.13和更高版本中可用。

--cpu-period=<value>

指定CPU CFS調度程序周期,該周期與--cpu-quota一起使用。默認為1秒,以微秒表示。大多數(shù)用戶不會從默認值更改此設置。如果您使用Docker 1.13或更高版本,請改用--cpus。

--cpu-quota=<value>

在容器上添加CPU CFS配額。每個--cpu-period允許CPU訪問的容器數(shù)微秒數(shù)。換句話說,cpu-quota / cpu-period。如果您使用Docker 1.13或更高版本,請改用--cpus。

--cpuset-cpus

限制容器可以使用的特定CPU或核心。如果您有多個CPU,則容器可以使用的逗號分隔列表或連字符分隔的CPU范圍。第一個CPU編號為0.有效值可能為0-3(使用第一,第二,第三和第四個CPU)或1,3(使用第二個和第四個CPU)。

--cpu-shares

將此標志設置為大于或小于默認值1024的值,以增加或減少容器的重量,并使其能夠訪問主機CPU周期的更大或更小比例。這僅在CPU周期受到限制時才會執(zhí)行。當大量CPU周期可用時,所有容器都使用盡可能多的CPU。這樣,這是一個軟限制。--cpu-shares不會阻止容器在群集模式下進行調度。它優(yōu)先考慮容器CPU資源的可用CPU周期。它不保證或保留任何特定的CPU訪問權限。

如果您有一個CPU,下面的每條命令將保證容器最多每秒占CPU的50%。

碼頭1.13及以上*

docker run -it --cpus=".5" ubuntu /bin/bash

碼頭1.12及以下*

$ docker run -it --cpu-period=100000 --cpu-quota=50000 ubuntu /bin/bash

配置實時調度程序

在Docker 1.13及更高版本中,可以將容器配置為使用實時調度程序,以處理無法使用cfs調度程序的任務。你需要確保主機的內核配置正確在你可以之前配置Docker守護進程或配置單個容器...

警告CPU調度和優(yōu)先級是高級內核級特性.。大多數(shù)用戶不需要從默認值中更改這些值。不正確地設置這些值會導致主機系統(tǒng)變得不穩(wěn)定或無法使用。

配置主機的內核

核實CONFIG_RT_GROUP_SCHED在linux內核中通過運行zcat /proc/config.gz | grep CONFIG_RT_GROUP_SCHED或者通過檢查文件的存在/sys/fs/cgroup/cpu.rt_runtime_us有關配置內核實時調度程序的指導,請參閱操作系統(tǒng)的文檔。

配置Docker守護進程

若要使用實時調度程序運行容器,請使用--cpu-rt-runtime標志設置為每個運行時期間為實時任務保留的最大微秒數(shù)。例如,默認周期為10000微秒%281秒%29,設置--cpu-rt-runtime=95000確保使用實時調度程序的容器每10000微秒可以運行95000微秒,為非實時任務留出至少5000微秒。使此配置在使用systemd,見用system d控制和配置Docker...

配置單個容器

在啟動容器時,可以傳遞幾個標志來控制容器的CPU優(yōu)先級。docker run查閱您的操作系統(tǒng)文檔或ulimit命令獲取有關適當值的信息。

選項

描述

--cap-add=sys_nice

授予容器CAP_SYS_NICE功能,允許容器提升進程的良好值,設置實時調度策略,設置CPU關聯(lián)和其他操作。

--cpu-rt-runtime=<value>

容器可以在Docker守護進程的實時調度程序期間以實時優(yōu)先級運行的最大微秒數(shù)。您還需要--cap-add = sys_nice標志。

--ulimit rtprio=<value>

容器允許的最大實時優(yōu)先級。您還需要--cap-add = sys_nice標志。

下面的示例命令設置debian:jessie集裝箱。

$ docker run --it --cpu-rt-runtime=95000 \                  --ulimit rtprio=99 \                  --cap-add=sys_nice \
                  debian:jessie

如果內核或Docker守護進程配置不正確,就會發(fā)生錯誤。

Article précédent: Article suivant: