新增说明及示例文件;更新README.md
This commit is contained in:
parent
55542ff806
commit
2e4d488295
30
README.md
30
README.md
@ -1,3 +1,29 @@
|
||||
# docker-compose
|
||||
# Docker Compose 示例文件
|
||||
|
||||
Docker Compose 说明及示例
|
||||
<br/>
|
||||
|
||||
## 命令说明
|
||||
### 启动
|
||||
``` shell
|
||||
docker-compose up
|
||||
```
|
||||
|
||||
### 停止
|
||||
``` shell
|
||||
docker-compose down
|
||||
```
|
||||
|
||||
### 重启
|
||||
``` shell
|
||||
docker-compose restart
|
||||
```
|
||||
|
||||
<br/>
|
||||
|
||||
## 服务说明
|
||||
### portainer
|
||||
Portainer Docker 管理器
|
||||
官网: https://www.portainer.io
|
||||
文档: https://docs.portainer.io
|
||||
### mysql
|
||||
MySQL 数据库
|
||||
|
50
description/compose.yaml
Normal file
50
description/compose.yaml
Normal file
@ -0,0 +1,50 @@
|
||||
version: "3.9"
|
||||
|
||||
services:
|
||||
${SERVICE_NAME}:
|
||||
image: ${IMAGE_NAME}:${IMAGE_TAG}
|
||||
container_name: ${CONTAINER_NAME}
|
||||
restart: on-failure:3
|
||||
privileged: true
|
||||
user: ${USER_NAME}:${USER_GROUP}
|
||||
working_dir: ${WORKING_DIR}
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- ${VOLUME_NAME}:${CONTAINER_PATH}
|
||||
- ${HOST_PATH}:${CONTAINER_PATH}
|
||||
configs:
|
||||
- ${CONFIG_NAME}
|
||||
secrets:
|
||||
- ${SECRET_NAME}
|
||||
environment:
|
||||
- ${KEY}=${VALUE}
|
||||
command: ${COMMAND}
|
||||
depends_on:
|
||||
- ${SERVICE_NAME}
|
||||
network_mode: host
|
||||
ports:
|
||||
- ${HOST_PORT}:${CONTAINER_PORT}
|
||||
networks:
|
||||
- ${NETWORK_NAME}
|
||||
|
||||
volumes:
|
||||
${VOLUME_NAME}:
|
||||
external: true
|
||||
name: ${VOLUME_NAME}
|
||||
|
||||
configs:
|
||||
${CONFIG_NAME}:
|
||||
external: true
|
||||
name: ${CONFIG_NAME}
|
||||
file: ${CONFIG_FILE_NAME}
|
||||
|
||||
secrets:
|
||||
${SECRET_NAME}:
|
||||
external: true
|
||||
name: ${SECRET_NAME}
|
||||
file: ${SECRET_FILE_NAME}
|
||||
|
||||
networks:
|
||||
${NETWORK_NAME}:
|
||||
external: true
|
||||
name: ${NETWORK_NAME}
|
26
examples/adminer/compose.yaml
Normal file
26
examples/adminer/compose.yaml
Normal file
@ -0,0 +1,26 @@
|
||||
version: "3.9"
|
||||
|
||||
services:
|
||||
adminer:
|
||||
image: adminer:4.8.1
|
||||
container_name: adminer
|
||||
hostname: adminer
|
||||
restart: always
|
||||
networks:
|
||||
- db_network
|
||||
ports:
|
||||
- "8080:8080"
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
|
||||
networks:
|
||||
db_network:
|
||||
name: db_network
|
||||
external: true
|
||||
# driver: bridge
|
||||
# driver_opts:
|
||||
# encrypted: 'true'
|
||||
# ipam:
|
||||
# driver: default
|
||||
# config:
|
||||
# - subnet: 172.21.0.1/24
|
46
examples/mariadb/10/compose.yaml
Normal file
46
examples/mariadb/10/compose.yaml
Normal file
@ -0,0 +1,46 @@
|
||||
version: "3.9"
|
||||
|
||||
services:
|
||||
mariadb:
|
||||
image: mariadb:10.11.5
|
||||
container_name: mariadb
|
||||
hostname: mariadb
|
||||
restart: always
|
||||
networks:
|
||||
- db_network
|
||||
ports:
|
||||
- "3306:3306"
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- mariadb_db:/var/lib/mysql
|
||||
configs:
|
||||
- source: mariadb_conf
|
||||
target: /etc/mysql/conf.d/my.cnf
|
||||
mode: 0444
|
||||
secrets:
|
||||
- mariadb_root_key
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/mariadb_root_key
|
||||
|
||||
volumes:
|
||||
mariadb_db:
|
||||
|
||||
configs:
|
||||
mariadb_conf:
|
||||
file: my.cnf
|
||||
|
||||
secrets:
|
||||
mariadb_root_key:
|
||||
file: root.key
|
||||
|
||||
networks:
|
||||
db_network:
|
||||
name: db_network
|
||||
external: true
|
||||
# driver: bridge
|
||||
# driver_opts:
|
||||
# encrypted: 'true'
|
||||
# ipam:
|
||||
# driver: default
|
||||
# config:
|
||||
# - subnet: 172.21.0.1/24
|
4
examples/mariadb/10/my.cnf
Normal file
4
examples/mariadb/10/my.cnf
Normal file
@ -0,0 +1,4 @@
|
||||
[mysqld]
|
||||
max_connections = 1000
|
||||
character-set-server = utf8mb4
|
||||
collation-server = utf8mb4_unicode_ci
|
1
examples/mariadb/10/root.key
Normal file
1
examples/mariadb/10/root.key
Normal file
@ -0,0 +1 @@
|
||||
5bkyVJsvXuSEZag8xChVXn9GEwHzrmvX
|
46
examples/mysql/5/compose.yaml
Normal file
46
examples/mysql/5/compose.yaml
Normal file
@ -0,0 +1,46 @@
|
||||
version: "3.9"
|
||||
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:5.7.43
|
||||
container_name: mysql
|
||||
hostname: mysql
|
||||
restart: always
|
||||
networks:
|
||||
- db_network
|
||||
ports:
|
||||
- "3306:3306"
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- mysql_db:/var/lib/mysql
|
||||
configs:
|
||||
- source: mysql_conf
|
||||
target: /etc/mysql/conf.d/my.cnf
|
||||
mode: 0444
|
||||
secrets:
|
||||
- mysql_root_key
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/mysql_root_key
|
||||
|
||||
volumes:
|
||||
mysql_db:
|
||||
|
||||
configs:
|
||||
mysql_conf:
|
||||
file: my.cnf
|
||||
|
||||
secrets:
|
||||
mysql_root_key:
|
||||
file: root.key
|
||||
|
||||
networks:
|
||||
db_network:
|
||||
name: db_network
|
||||
external: true
|
||||
# driver: bridge
|
||||
# driver_opts:
|
||||
# encrypted: 'true'
|
||||
# ipam:
|
||||
# driver: default
|
||||
# config:
|
||||
# - subnet: 172.21.0.1/24
|
4
examples/mysql/5/my.cnf
Normal file
4
examples/mysql/5/my.cnf
Normal file
@ -0,0 +1,4 @@
|
||||
[mysqld]
|
||||
max_connections = 1000
|
||||
character-set-server = utf8mb4
|
||||
collation-server = utf8mb4_unicode_ci
|
1
examples/mysql/5/root.key
Normal file
1
examples/mysql/5/root.key
Normal file
@ -0,0 +1 @@
|
||||
6vTWXiZUU5nz7AVCYaCis8GqVF6TZhHH
|
46
examples/mysql/8/compose.yaml
Normal file
46
examples/mysql/8/compose.yaml
Normal file
@ -0,0 +1,46 @@
|
||||
version: "3.9"
|
||||
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:8.0.34
|
||||
container_name: mysql
|
||||
hostname: mysql
|
||||
restart: always
|
||||
networks:
|
||||
- db_network
|
||||
ports:
|
||||
- "3306:3306"
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- mysql_db:/var/lib/mysql
|
||||
configs:
|
||||
- source: mysql_conf
|
||||
target: /etc/mysql/conf.d/my.cnf
|
||||
mode: 0444
|
||||
secrets:
|
||||
- mysql_root_key
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/mysql_root_key
|
||||
|
||||
volumes:
|
||||
mysql_db:
|
||||
|
||||
configs:
|
||||
mysql_conf:
|
||||
file: my.cnf
|
||||
|
||||
secrets:
|
||||
mysql_root_key:
|
||||
file: root.key
|
||||
|
||||
networks:
|
||||
db_network:
|
||||
name: db_network
|
||||
external: true
|
||||
# driver: bridge
|
||||
# driver_opts:
|
||||
# encrypted: 'true'
|
||||
# ipam:
|
||||
# driver: default
|
||||
# config:
|
||||
# - subnet: 172.21.0.1/24
|
4
examples/mysql/8/my.cnf
Normal file
4
examples/mysql/8/my.cnf
Normal file
@ -0,0 +1,4 @@
|
||||
[mysqld]
|
||||
max_connections = 1000
|
||||
character-set-server = utf8mb4
|
||||
collation-server = utf8mb4_unicode_ci
|
1
examples/mysql/8/root.key
Normal file
1
examples/mysql/8/root.key
Normal file
@ -0,0 +1 @@
|
||||
msQijJXzLmeEfmy3j5nQBn7hsVFbd6F3
|
28
examples/phpmyadmin/compose.yaml
Normal file
28
examples/phpmyadmin/compose.yaml
Normal file
@ -0,0 +1,28 @@
|
||||
version: "3.9"
|
||||
|
||||
services:
|
||||
phpmyadmin:
|
||||
image: phpmyadmin:5.2.1
|
||||
container_name: phpmyadmin
|
||||
hostname: phpmyadmin
|
||||
restart: always
|
||||
networks:
|
||||
- db_network
|
||||
ports:
|
||||
- "80:80"
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
environment:
|
||||
- PMA_ARBITRARY=1
|
||||
|
||||
networks:
|
||||
db_network:
|
||||
name: db_network
|
||||
external: true
|
||||
# driver: bridge
|
||||
# driver_opts:
|
||||
# encrypted: 'true'
|
||||
# ipam:
|
||||
# driver: default
|
||||
# config:
|
||||
# - subnet: 172.21.0.1/24
|
30
examples/portainer/compose.yaml
Normal file
30
examples/portainer/compose.yaml
Normal file
@ -0,0 +1,30 @@
|
||||
version: "3.9"
|
||||
|
||||
services:
|
||||
portainer:
|
||||
image: portainer/portainer-ce:2.19.0-alpine
|
||||
container_name: portainer
|
||||
hostname: portainer
|
||||
restart: always
|
||||
ports:
|
||||
- "9000:9000"
|
||||
- "9443:9443"
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- portainer_data:/data
|
||||
|
||||
volumes:
|
||||
portainer_data:
|
||||
|
||||
networks:
|
||||
app_network:
|
||||
name: app_network
|
||||
external: true
|
||||
# driver: bridge
|
||||
# driver_opts:
|
||||
# encrypted: 'true'
|
||||
# ipam:
|
||||
# driver: default
|
||||
# config:
|
||||
# - subnet: 172.21.0.1/24
|
Loading…
Reference in New Issue
Block a user