** Database **, I think it will almost certainly be used in enterprise and other application development even in 2020. However, as in the past, there are still many people who do their best to manually install the production environment, verification environment, and development environment directly on the host OS.
(Maybe it's a little overstated) ** It's a waste of time to spend more than 5 minutes installing the database in your development environment! ** **
Now, remember that you can quickly install DB with Docker at this time. However, if you need to ensure redundancy or availability, such as in a production environment, use an installation method that meets your requirements.
Oracle Database on Docker
SQL Server on Docker
--[Docker Hub --Microsoft SQL Server] dockerrepo-mssql(Ubuntu base)
Please create docker-compose.yaml by referring to this [repository] github-docker-mssql published on GitHub.
docker-compose.yaml
version: '3'
services:
mssql:
image: mcr.microsoft.com/mssql/rhel/server:2019-latest
container_name: 'mssql2019-latest-rhel'
environment:
- MSSQL_SA_PASSWORD=<your_strong_password>
- ACCEPT_EULA=Y
# - MSSQL_PID=<your_product_id> # default: Developer
# - MSSQL_PID=Express
# - MSSQL_PID=Standard
# - MSSQL_PID=Enterprise
# - MSSQL_PID=EnterpriseCore
ports:
- 1433:1433
# volumes: # Mounting a volume does not work on Docker for Mac
# - ./mssql/log:/var/opt/mssql/log
# - ./mssql/data:/var/opt/mssql/data
Start the container with docker-compose up -d
and the SQL Server installation is complete.
docker-compose up -d
MySQL on Docker
Please create docker-compose.yaml by referring to this [repository] github-docker-mysql published on GitHub.
docker-compose.yaml
version: '3'
services:
db:
image: mysql:8
container_name: mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: P@ssw0rd #required
# MYSQL_DATABASE: employees #optional
# MYSQL_USER: user #optional
# MYSQL_PASSWORD: P@ssw0rd #optional
# MYSQL_ALLOW_EMPTY_PASSWORD: "yes" #optional
# MYSQL_RANDOM_ROOT_PASSWORD: "yes" #optional
# MYSQL_ONETIME_PASSWORD: "yes" #optional (MySQL 5.6 or above)
# MYSQL_INITDB_SKIP_TZINFO: "" #optional
ports:
- 3306:3306
volumes:
- ./data/mysql:/var/lib/mysql
- ./conf:/etc/mysql/conf.d
Start the container with docker-compose up -d
and the MySQL installation is complete.
docker-compose up -d
PostgreSQL on Docker
Please create docker-compose.yaml by referring to this [repository] github-docker-postgres published on GitHub.
docker-compose.yaml
version: '3'
services:
db:
image: postgres:13
container_name: postgres
restart: always
environment:
POSTGRES_PASSWORD: P@ssw0rd #required
# POSTGRES_USER: postgres #optional
# POSTGRES_DB: postgres #optional
# POSTGRES_INITDB_ARGS: "--data-checksums" #optional
# POSTGRES_INITDB_WALDIR: "" #optional (PostgreSQL 10+ or above)
# POSTGRES_INITDB_XLOGDIR: "" #optional (PostgreSQL 9.x only)
# POSTGRES_HOST_AUTH_METHOD: trust #optional
# PGDATA: /var/lib/postgresql/data/pgdata #optional
ports:
- 5432:5432
volumes:
- ./data:/var/lib/postgresql/data
Start the container with docker-compose up -d
and the PostgreSQL installation is complete.
docker-compose up -d
MongoDB on Docker
Please create docker-compose.yaml by referring to this [repository] github-docker-mongodb published on GitHub.
docker-compose.yaml
version: '3'
services:
mongo:
image: mongo:latest
container_name: mongodb
restart: always
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: P@ssw0rd
ports:
- 27017:27017
volumes:
- ./data/db:/data/db
- ./data/configdb:/data/configdb
# Command 1: Customize configuration without configuration file
# Command 2: Setting WiredTiger cache size limits
# command: >
# --serviceExecutor adaptive
# --wiredTigerCacheSizeGB 1.5
mongo-express:
image: mongo-express:latest
container_name: mongo-express
restart: always
ports:
- 8081:8081
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME: root
ME_CONFIG_MONGODB_ADMINPASSWORD: P@ssw0rd
Start the container with docker-compose up -d
and the MongoDB installation is complete.
docker-compose up -d
As for the management tool, you can use whatever you like, but the recommended method is to use ** Visual Studio Code **. It's very convenient because you can do both Docker Compose and DB operations within Visual Studio Code. Please refer to the following article for details.
--[Convenient extension for working with SQL Database on Visual Studio Code] vscode-mssql -[Convenient extension for working with MySQL on Visual Studio Code] vscode-mysql --[Convenient extension for working with PostgreSQL and Cosmos DB on Visual Studio Code] vscode-postgres --[Convenient extension for working with MongoDB on Visual Studio Code] vscode-mongodb
Also, I think it would be ant to create the adminer container described in MySQL and PostgreSQL together.
Oracle Database
SQL Server
MySQL
PostgresSQL
MongoDB
Recommended Posts