Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Docker-compose, one of the three musketeers of docker.

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Docker-compose of the three Musketeers of Docker

Orchestration tool for Docker containers. (to help simplify the operation)

Multiple container management that addresses interdependencies.

Verify that there is a docker-compose command

Docker-compose-v

Configuration file instance of docker-compose

Manage the container by identifying a docker-compose.yml configuration file.

[root@docker ~] # mkdir compose_test

[root@docker ~] # cd compose_test/

Go back / down

/ / set the number of spaces for the tab key

Vim .vimrc

Note the format:

Vim docker-compose.yml

Version: "3" services: nginx: container_name: web-nginx image: nginx restart: always ports:-90:80 volumes: -. / webserver:/usr/share/nginx/html

The first part: version: specifies the version of the syntax format.

The second part; service: define the service (what kind of container you want to run)

/ / run the container specified by docker-compose. PS; also needs to have a docker-compose.yml configuration file in the current directory where this command is executed.

Docker-compose up-d

/ / stop running

Docker-compose stop

/ / restart

Docker-compose restart

Back under root and, while running container, you can also support Dockerfile

Docker-compose-f compose_test/docker-compose.yml stop

Under the compose_test directory

Vim dockerfile

In vim docker-compose.yml

Modify in

Stop first, before deleting the previous one

After the update

Make a visit.

Curl 127.0.0.1:90

Set up wordpress's blog

Mkdir wordpress

Cd / root/wordpress

Vim docker-compose.yml

Version: "3.1" services: wordpress: image: wordpress restart: always ports:-8080 image 80 environment: WORDPRESS_DB_HOST: db WORDPRESS_DB_USER: wordpress WORDPRESS_DB_PASSWORD: 123.com WORDPRESS_DB_NAME: wordpress db: image: mysql:5.7 restart: always environment: MYSQL_DATABASE: wordpress MYSQL_USER: wordpress MYSQL_PASSWORD: 123.com MYSQL_ROOT_PASSWORD: 123.com

Import package

Docker load < mysql-5.7.tar

Docker load < wordpress.tar

Docker-compose up-d

Visit the page (if not, add route forwarding)

Change the language

Monitoring of Docker

Monitoring commands that come with Docker

Docker top / stats / logs

Import Mirror

Sysdig

Docker images

Report the mistake and call again.

# # sysdig-probe-loader

Sysdig

Execute s after ctrl+c stops after running

Csysdig

F2 enter the page and select containers to view the running status of the container.

Scope

Import Mirror

Curl-L git.io/scope-o / usr/local/bin/scope

Add authority

Chmod + x / usr/local/bin/scope

The firewall must be turned off

Visit 192.168.1.20VR 4040

Monitor two dockerhost

Give orders on the second stage

Import package

Curl-L git.io/scope-o / usr/local/bin/scope

Scope launch

Add authority

Chmod + x / usr/local/bin/scope

Scope launch 192.168.1.1 192.168.1.30

Visit the page

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report