In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces the relevant knowledge of "how to install docker compose". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Pre-knowledge
Compose is a tool for Docker container orchestration and a sharp tool for integrating and publishing docker applications. You can define and run multi-container applications. In Compose, you can use YAML files to configure your application services. Then, with a simple command, you can create and start all the services you configure.
Docker-compose is based on docker, so we need to install docker before we can use docker-compose.
There are basically three steps to using Compose:
Define your application environment in Dockfile, which can be multiple docker applications.
Define the services that make up the application in docker-compose.yml.
Use the dcoker-compose up command to run the entire application solution.
Docker installation
Uninstall the old version
Sudo yum remove docker\ docker-client\ docker-client-latest\ docker-common\ docker-latest\ docker-latest-logrotate\ docker-logrotate\ docker-engine
Install Docker Engine-Community
Sudo yum install-y yum-utils device-mapper-persistent-data lvm2sudo yum-config-manager\-- add-repo\ http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.reposudo yum install docker-ce docker-ce-cli containerd.io
Start docker
Sudo systemctl start docker
Install the plug-in
Yum install https://download.docker.com/linux/fedora/30/x86_64/stable/Packages/containerd.io-1.2.6-3.3.fc30.x86_64.rpm
Test whether docker is installed successfully
Docker-version
This is where the docker installation is complete!
Docker-compose installation
The download address on the official website may be slow. It is recommended to use the following
Download and install
Curl-L https://get.daocloud.io/docker/compose/releases/download/1.26.2/docker-compose-`uname-s`-`uname-m` > / usr/local/bin/docker-compose
Authorization (must be authorized, responsible without permission)
Chmod + x / usr/local/bin/docker-compose
Verify that docker-compose is installed successfully (check the version)
Docker-compose version
Docker-compose has been installed successfully!
Getting started with Docker Compose
Generate mysql and redis containers through docker-compose
1. Create a project directory and enter the
$mkdir composetest$ cd composetest
two。 Create a docker-compose.yml file and put it in the project directory
The specific contents of the document are as follows:
Version: "3.0" services: mysqldb: image: mysql:5.7.19 container_name: mysql ports: -" 3306 image 3306 "volumes:-/ root/mysql/conf:/etc/mysql/conf.d-/ root/mysql/logs:/logs-/ root/mysql/data:/var/lib/mysql environment: MYSQL_ROOT_PASSWORD: root networks:-ems Depends_on:-redis redis: image: redis:4.0.14 container_name: redis ports:-"6379redis:4.0.14 container_name 6379" networks:-ems volumes:-/ root/redis/data:/data command: redis-server networks: ems:
3. Start
Start in the current folder
Foreground start
Docker-compose up
Background start
Docker-compose up-d
The output log is as follows
Check to see if containers are available in docker
Check to see if the container generates
Test whether the redis container is available
Test whether the mysql container is available
At this point, the entry case has been completed!
This is the end of "how to install docker compose". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.