当前位置:   article > 正文

docker-compose.yml文件安装consul ftp redis rabbitmq ftp,mysql ,mssql_docker-compose安装ftp

docker-compose安装ftp
  1. version: '3'
  2. networks:
  3. byfn:
  4. services:
  5. consul:
  6. image: consul
  7. container_name: consul
  8. restart: always #重启docker引擎后该容器也重启
  9. command: consul agent -server -ui -node=node -bind=0.0.0.0 -client=0.0.0.0 -data-dir /consul/data -config-dir /consul/config -bootstrap-expect=1
  10. volumes: #卷挂载路径设置
  11. - ./consul/config:/consul/config #将容器内的日志挂载到宿主里
  12. - ./consul/data:/consul/data
  13. ports:
  14. - 8500:8500
  15. networks:
  16. - byfn
  17. redis:
  18. image: redis
  19. container_name: redis
  20. restart: always #重启docker引擎后该容器也重启
  21. volumes: #指定挂载目录
  22. - ./redis/redis.conf:/usr/local/etc/redis/redis.conf #redis.conf文件和data目录分别映射了主机的redis.conf文件和主机的data目录
  23. - ./redis/data:/data
  24. command:
  25. /bin/bash -c "redis-server /usr/local/etc/redis/redis.conf " #使用command可以覆盖容器启动后默认执行的命令。这里启动执行指定的redis.conf文件
  26. ports:
  27. - 6379:6379
  28. networks:
  29. - byfn
  30. ftp:
  31. image: fauria/vsftpd
  32. container_name: ftp
  33. restart: always #重启docker引擎后该容器也重启
  34. environment:
  35. FTP_USER: ftpusr #ftp账户
  36. FTP_PASS: 1qazXSW@ #ftp秘钥
  37. PASV_MIN_PORT: 21100 #ftp被动模式下的最小端口
  38. PASV_MAX_PORT: 21110 #ftp被动模式下的最大端口
  39. PASV_ADDRESS: 127.0.0.1
  40. PASV_ENABLE: 'YES'
  41. volumes: #指定挂载目录
  42. - ./ftp/data:/home/vsftpd
  43. ports:
  44. - '21:21'
  45. - '20:20'
  46. - 21100-21110:21100-21110
  47. networks:
  48. - byfn
  49. rabbitmq:
  50. image: rabbitmq:management
  51. container_name: rabbitmq
  52. restart: always #重启docker引擎后该容器也重启
  53. hostname: rabbitmq #根据所谓的 “节点名称” 存储数据,默认为主机名
  54. environment:
  55. RABBITMQ_DEFAULT_VHOST: my_vhost #默认虚拟机名
  56. RABBITMQ_DEFAULT_USER: admin #默认的用户名
  57. RABBITMQ_DEFAULT_PASS: admin #默认用户名的密码
  58. volumes: #指定挂载目录
  59. - ./rabbitmq/data:/var/lib/rabbitmq
  60. ports:
  61. - 4369:4369
  62. - 5671:5671
  63. - 5672:5672
  64. - 15671:15671
  65. - 15672:15672
  66. - 15691:15691
  67. - 15692:15692
  68. - 25672:25672
  69. networks:
  70. - byfn
  71. mysql:
  72. image: mysql:8.0.30
  73. restart: always #重启docker引擎后该容器也重启
  74. container_name: mysql8
  75. hostname: mysql
  76. environment:
  77. MYSQL_ROOT_PASSWORD: 1qazXSW@
  78. TZ: Asia/Shanghai
  79. volumes:
  80. - ./mysql/conf/my.cnf:/etc/my.cnf
  81. - ./mysql/data:/var/lib/mysql:rw
  82. - ./mysql/logs:/var/log/mysql
  83. command:
  84. --default-authentication-plugin=mysql_native_password
  85. --character-set-server=utf8mb4
  86. --collation-server=utf8mb4_general_ci
  87. --explicit_defaults_for_timestamp=true
  88. --default-time-zone=+8:00
  89. --lower_case_table_names=1
  90. ports:
  91. - 3306:3306
  92. es:
  93. container_name: es
  94. hostname: es
  95. image: elasticsearch:7.1.1
  96. restart: always
  97. ports:
  98. - 9200:9200
  99. - 9300:9300
  100. environment:
  101. - "ES_JAVA_OPTS=-Xmx2048m -Xmx2048m" #设置使用jvm内存大小
  102. - "discovery.type=single-node" #以单一节点模式启动
  103. - "cluster.name=elasticsearch" #设置集群名称为elasticsearch
  104. - TAKE_FILE_OWNERSHIP=true #volumes 挂载权限问题 不加上会报java虚拟机错误
  105. - "ELASTIC_PASSWORD=elastic" # elastic账号密码(密码不要带@)
  106. volumes:
  107. - ./es-kibana/es/master/conf/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
  108. - ./es-kibana/es/master/data:/usr/share/elasticsearch/data
  109. - ./es-kibana/es/master/logs:/usr/share/elasticsearch/logs
  110. networks:
  111. - byfn
  112. kibana:
  113. container_name: kibana
  114. hostname: kibana
  115. image: kibana:7.1.1
  116. restart: always
  117. ports:
  118. - 5601:5601
  119. volumes:
  120. - ./es-kibana/kibana/kibana.yml:/usr/share/kibana/config/kibana.yml
  121. environment:
  122. - elasticsearch.hosts=http://10.0.171.103:9200
  123. depends_on:
  124. - es
  125. networks:
  126. - byfn
  127. mysql5:
  128. image: mysql:5.7
  129. restart: always #重启docker引擎后该容器也重启
  130. container_name: mysql5
  131. hostname: mysql5
  132. environment:
  133. MYSQL_ROOT_PASSWORD: 1qazXSW@
  134. TZ: Asia/Shanghai
  135. volumes:
  136. - ./mysql5/conf/my.cnf:/etc/my.cnf
  137. - ./mysql5/data:/var/lib/mysql:rw
  138. - ./mysql5/logs:/var/log/mysql
  139. command:
  140. --default-authentication-plugin=mysql_native_password
  141. --character-set-server=utf8mb4
  142. --collation-server=utf8mb4_general_ci
  143. --explicit_defaults_for_timestamp=true
  144. --default-time-zone=+8:00
  145. --lower_case_table_names=1
  146. ports:
  147. - 3307:3306
  148. networks:
  149. - byfn
  150. mssql:
  151. image: mcr.microsoft.com/mssql/server:2017-latest
  152. restart: always #重启docker引擎后该容器也重启
  153. container_name: mssql
  154. privileged: true
  155. ports:
  156. - "1433:1433"
  157. environment:
  158. - ACCEPT_EULA=Y
  159. - SA_PASSWORD=1qazXSW@
  160. - TZ=Asia/Shanghai
  161. volumes:
  162. - ./mssql/data:/var/opt/mssql
  163. networks:
  164. - byfn
  165. oracle:
  166. image: oracleinanutshell/oracle-xe-11g
  167. restart: always #重启docker引擎后该容器也重启
  168. container_name: oracle
  169. privileged: true
  170. ports:
  171. - "1521:1521"
  172. - "8090:8080"
  173. environment:
  174. - TZ=Asia/Shanghai
  175. volumes:
  176. - ./oracle/data:/u01/app/oracle/product/11.2.0/xe/oradata
  1. 1、登录物理机执行权限
  2. chmod 777 /opt/mssql/data/LAHB_0.ldf
  3. chmod 777 /opt/mssql/data/LAHB.mdf
  4. 2、进入Docker执行还原命令
  5. docker exec -it mssql /bin/bash
  6. /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 1qazXSW@
  7. >EXEC sp_attach_db @dbname = 'LAHB',
  8. >@filename1 = '/var/opt/mssql/data/LAHB_0.ldf',
  9. >@filename2 = '/var/opt/mssql/data/LAHB.mdf'
  10. >GO

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/74068
推荐阅读
相关标签
  

闽ICP备14008679号