What is Docker-Compose The Compose project originated from the previous fig project. It is written in Python and has a high degree of compatibility with docker/swarm. Compose is a tool for orchestrating Docker containers. It defines and runs multi-container applications. Multiple containers can be started with one command. Using Docker Compose, you no longer need to use shell scripts to start containers. Compose manages multiple Docker containers through a configuration file. In the configuration file, all containers are defined through services, and then the docker-compose script is used to start, stop, and restart the application, the services in the application, and the containers of all dependent services. It is very suitable for scenarios where multiple containers are combined for development. The default template file for docker-compose is docker-compose.yml, in which each service defined must be automatically built by specifying an image through the image instruction or the build instruction (Dockerfile is required). Using Compose basically involves the following three steps: 1. Define your application environment in a Dockerfile so that it can be replicated anywhere. Let's look at the problem that mysql cannot be accessed when deployed by docker-compose. This problem has troubled me for a long time. After using version: "3.3" services: Redis: image: sameersbn/redis:latest ports: - "6379:6379" volumes: - redis_data:/var/lib/redis restart: always mysql: image: mysql:latest restart: always command: --default-authentication-plugin=mysql_native_password #This line of code solves the problem of inaccessible networks: -dev ports: - "3306:3306" environment: MYSQL_ROOT_PASSWORD: abc123 MYSQL_USER: 'test' MYSQL_PASS: 'test' volumes: -mysql_data:/var/lib/mysql networks: dev: driver: bridge volumes: redis_data: mysql_data: Summarize The above is the problem of inaccessible mysql deployment using docker-compose that I introduced to you. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
>>: Instructions for recovering data after accidental deletion of MySQL database
Preface This article mainly introduces the releva...
Table of contents 1. What is SVN 2. Svn server an...
When you use the docker command for the first tim...
Core code -- Below I will demonstrate the impleme...
Overflow Hide It means hiding text or image infor...
Ⅰ. Problem description: Use CSS to achieve 3D con...
mysql records time-consuming sql MySQL can record...
Today, I found out while working on PHP that if w...
Table of contents The first step is to download M...
Table of contents Component Communication Introdu...
This article records the installation and configu...
A common suggestion is to create indexes for WHER...
1. Dashed box when cancel button is pressed <br...
Because I wrote the word transition incorrectly i...
1. There are generally two methods for Vue routin...