Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to orchestrate Docker containers

Shulou Source: shulou.com Published: 2022-06-03 02:20:00 09月19日 Update

Docker Container is an open source application container engine that allows developers to package their applications and dependencies into a portable container in a unified way, and then publish them to any server with docker engine installed (including popular Linux machines, windows machines), and can also implement virtualization. Containers are completely sandboxed and do not have any interface to each other (similar to iPhone's app). There is almost no performance overhead and can be easily run in machines and data centers. Most importantly, they do not rely on any language, framework, including systems.

Step 1: create the yml file [root@host1 ~] # vim docker-compose.ymlversion: '3'services: web: image: nginx:latest ports:-"5000 root@host1 5000" links:-redis redis: image: redis step 2: launch the container [root@host1 ~] # docker-compose up-d step 3: check the status of the process started through compose [root@host1 ~] # docker-compose ps Name Command State Ports- -root_redis_1 docker-entrypoint.sh redis... Up 6379/tcp root_web_1 nginx-g daemon off; Up 0.0.0.0 root@host1 5000-> 5000/tcp, 80/tcp step 4: view log information [root@host1 ~] # docker-compose logs step 5: shut down the service [root@host1 ~] # docker-compose down Stopping root_web_1. DoneStopping root_redis_1... DoneRemoving root_web_1... DoneRemoving root_redis_1... DoneRemoving network root_default case 2 first step: create the Dockerfile file [root@host1 ~] # vim Dockerfile#Nginx#Version 1.0.1#Author zxhk#Base imageFROM centos:7#MaintainerMAINTAINER zxhk08@qq.com#CommandsRUN rpm-ivh http://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpmRUN yum install-y nginxRUN echo "daemon off "> > / etc/nginx/nginx.confEXPOSE 80CMD [" nginx "] step 2: execute the Dockerfile file [root@host1 ~] # docker build-t newweb/nginx:v1-1. / step 3: build docker-compose.yml [root@host1 ~] # vim docker-compose.ymlversion: '2'services: web1: image: newweb/nginx:v1.0.1 volumes:-/ data/www1:/usr/share/nginx/html ports:- "8080 web2 80" web2: image: newweb/nginx:v1.0.1 volumes:-/ data/www2:/usr/share/nginx/html ports:-"8081 data/www2:/usr/share/nginx/html ports 80" web3: image: newweb/nginx:v1.0.1 volumes:-/ data/www3:/usr/share/nginx/html ports:-"8082 data/www2:/usr/share/nginx/html ports 80" step 4: start building [8082] # docker-compose up-d step 5: check the status of the process started through compose [root@host1 ~] # docker-compose ps step 6: view log information [root@host1 ~] # docker-compose logs step 7: shut down the service [root@host1 ~] # docker-compose down

Tags: Containers files machines services information engines logs status processes applications importance each other between developers overhead performance interfaces data data centers methods Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft vpn Redmi macOS Huawei