Get the App
SLTechnology News&Howtos  ›  Servers  › 

Docker-compose deploy MySQL+Redis+ with one click

Shulou Source: shulou.com Published: 2022-06-03 09:48:33 11月15日 Update

Docker containers quickly and efficiently deploy applications, resource orchestration defines and runs multiple containers, declares each service through docker-compose.yml configuration files, and creates and starts as a whole.

MySQL+Redis+ActiveMQ is a commonly used development environment, installation and configuration is a bit cumbersome, new engineers or new machines often take a lot of time, why not try Docker-compose one-click deployment?

L data layers in common architectures:

L Docker installation:

Https://docs.docker.com/install/linux/docker-ce/ubuntu/

Https://docs.docker.com/docker-for-windows/install/

L script download:

Https://github.com/rickding/HelloDocker/tree/master/data

├── docker-compose.yml

├── pull.sh

├── up.sh

├── logs.sh

├── down.sh

L docker-compose.yml script configuration service:

Db_admin needs to connect to the MySQL instance, so the depends_on property is set.

Version:'3'

Services:

Db:

Image: mysql:5

Command:-- default-authentication-plugin=mysql_native_password

Ports:

-3306 3306

Environment:

MYSQL_DATABASE: starter

MYSQL_ROOT_PASSWORD: root

Db_admin:

Image: adminer:latest

Ports:

-3006 purl 8080

Depends_on:

-db

Cache:

Image: redis:4

Command: redis-server-- appendonly yes

Ports:

-6379PUR 6379

Mq:

Image: webcenter/activemq:latest

Ports:

-61616purl

-8161 Phantom 8161

L pull.sh pull image

You can run docker pull mysql:5 directly to pull the image and view it with docker images:

L up.sh startup container

The docker-compose up-d command is encapsulated in the script. After startup, run docker ps to view the container instance:

L logs.sh View Log

Custom commands highlight important information:

Docker-compose logs-ft | grep-- color-I-e error-e warn-e version-e exception

L down.sh stop service

Docker-compose down-- remove-orphans stops and deletes the container:

L View services:

Db_admin:

ActiveMQ:

Using docker-compose to deploy MySQL+Redis+ActiveMQ with one click is as simple as wayward.

Tags: Containers services runs scripts configurations one-click commands instances mirrors important wayward tedious information multiple that is properties engineering engineers common common Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno macOS Huawei Shulou Information NVidia