Detailed process of building mongodb and mysql with docker-compose

Detailed process of building mongodb and mysql with docker-compose

Let's take a look at the detailed method of building mongodb and mysql with docker-compose. The content is as follows:

version: '3'
services:
  mysqldbservice:
    image: 'mysql:latest'
    restart: always
    container_name: mysqlcontainer
    volumes:
      - ./data:/var/lib/mysql
      - ./my.cnf:/etc/mysql/my.cnf
      - ./init:/docker-entrypoint-initdb.d/
    ports:
      - 3306:3306 #“Host port number: container port number”
    environment:
      MYSQL_ROOT_PASSWORD: ""
      MYSQL_USER: '' # Create a common user MYSQL_PASSWORD: '' # Common user password MYSQL_DATABASE: '' # Create a library mongodbservice:
  # Image name. If the version number is not specified, the latest version will be pulled by default. image: mongo:latest
    # Port mapping ports:
    # Host port: container port - 27017:27017
    # Container data mount, persistent volumes:
    # Host directory: container directory: read and write permissions - ./mongo:/data/db:rw
    - ./configdb:/data/configdb:rw
    # Set environment variables:
    - TZ=Asia/Shanghai
    #Container name container_name: mongocontainer

my.cnf

[mysqld]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
secure-file-priv= NULL
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

# Custom config should go here
!includedir /etc/mysql/conf.d/

This is the end of this article about using docker-compose to build mongodb and mysql. For more information about using docker-compose to build mongodb, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Docker compose deploys SpringBoot project to connect to MySQL and the pitfalls encountered
  • Implementation of docker-compose deployment project based on MySQL8
  • How to run MySQL using docker-compose
  • Use dockercompose to build springboot-mysql-nginx application
  • A brief analysis of the problem of mysql being inaccessible when deployed with docker-compose
  • How to build an elk system using docker compose

<<:  How to use crontab to backup MySQL database regularly in Linux system

>>:  Page Refactoring Skills - Javascript, CSS

Recommend

Vue implements QR code scanning function (with style)

need: Use vue to realize QR code scanning; Plugin...

CSS code to control the background color of the web page

I think everyone often worries about finding pict...

Linux virtual memory settings tutorial and practice

What is Virtual Memory? First, I will directly qu...

Vue Getting Started with Weather Forecast

This article example shares the specific code of ...

Vue+spring boot realizes the verification code function

This article example shares the specific code of ...

MySQL index failure principle

Table of contents 1. Reasons for index failure 2....

Native JS to implement sharing sidebar

This article shares a sharing sidebar implemented...

Typora code block color matching and title serial number implementation code

Effect: The title has its own serial number, the ...

isPrototypeOf Function in JavaScript

Table of contents 1. isPrototypeOf() Example 1, O...

Detailed explanation of Linux index node inode

1. Introduction to inode To understand inode, we ...

Four methods of using JS to determine data types

Table of contents Preface 1. typeof 2. instanceof...

Pure CSS3 to achieve pet chicken example code

I have read a lot of knowledge and articles about...

Detailed explanation of reduce fold unfold usage in JS

Table of contents fold (reduce) Using for...of Us...