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

How to use Compose in Docker

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

I believe many inexperienced people don't know what to do about how to use Compose in Docker. Therefore, this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

Brief introduction:

Compose is a tool software developed by Docker company, which can manage multiple Docker containers to form an application. You need to define a configuration file docker-compose.yml in YAML format and write the invocation relationship between many containers. Then, with a single command, you can start / close these containers at the same time.

# start all services $docker-compose up# shut down all services $docker-compose stop installation:

When Mac and Windows install docker, they install docker compose together. Refer to the official documentation for installation under the Linux system

Check whether the installation is successful: $docker-compose-- version

Use:

A standard docker-compose.yml file should contain three parts: version, services and networks, the most important of which are services and networks.

Docker runs commands to convert to docker-compose.yml instances

The docker command executes 2 mirrors:

Docker run-d-p 9020 sysctl net.core.somaxconn=4096 registry.leyantech.com/infra/wp-apidocker run-d-p 88:80 registry.leyantech.com/infra/wp-vue

Convert to docker-compose:

Version: "3" services: wp-vue: image: registry.leyantech.com/infra/wp-vue ports:-"88:80" volumes:-/ data/nginx/conf/nginx.conf:/etc/nginx/nginx.conf-/ data/nginx/conf.d:/etc/nginx/conf.d-/ data/nginx/logs:/var/log/nginx restart: always wp-api: image : registry.leyantech.com/infra/wp-api sysctls:-net.core.somaxconn=4096 ports:-"9020 restart: always read the above content Have you mastered how to use Compose in Docker? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

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

Internet Technology

Wechat

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

12
Report