赞
踩
version: '3' networks: byfn: services: consul: image: consul container_name: consul restart: always #重启docker引擎后该容器也重启 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 volumes: #卷挂载路径设置 - ./consul/config:/consul/config #将容器内的日志挂载到宿主里 - ./consul/data:/consul/data ports: - 8500:8500 networks: - byfn redis: image: redis container_name: redis restart: always #重启docker引擎后该容器也重启 volumes: #指定挂载目录 - ./redis/redis.conf:/usr/local/etc/redis/redis.conf #redis.conf文件和data目录分别映射了主机的redis.conf文件和主机的data目录 - ./redis/data:/data command: /bin/bash -c "redis-server /usr/local/etc/redis/redis.conf " #使用command可以覆盖容器启动后默认执行的命令。这里启动执行指定的redis.conf文件 ports: - 6379:6379 networks: - byfn ftp: image: fauria/vsftpd container_name: ftp restart: always #重启docker引擎后该容器也重启 environment: FTP_USER: ftpusr #ftp账户 FTP_PASS: 1qazXSW@ #ftp秘钥 PASV_MIN_PORT: 21100 #ftp被动模式下的最小端口 PASV_MAX_PORT: 21110 #ftp被动模式下的最大端口 PASV_ADDRESS: 127.0.0.1 PASV_ENABLE: 'YES' volumes: #指定挂载目录 - ./ftp/data:/home/vsftpd ports: - '21:21' - '20:20' - 21100-21110:21100-21110 networks: - byfn rabbitmq: image: rabbitmq:management container_name: rabbitmq restart: always #重启docker引擎后该容器也重启 hostname: rabbitmq #根据所谓的 “节点名称” 存储数据,默认为主机名 environment: RABBITMQ_DEFAULT_VHOST: my_vhost #默认虚拟机名 RABBITMQ_DEFAULT_USER: admin #默认的用户名 RABBITMQ_DEFAULT_PASS: admin #默认用户名的密码 volumes: #指定挂载目录 - ./rabbitmq/data:/var/lib/rabbitmq ports: - 4369:4369 - 5671:5671 - 5672:5672 - 15671:15671 - 15672:15672 - 15691:15691 - 15692:15692 - 25672:25672 networks: - byfn mysql: image: mysql:8.0.30 restart: always #重启docker引擎后该容器也重启 container_name: mysql8 hostname: mysql environment: MYSQL_ROOT_PASSWORD: 1qazXSW@ TZ: Asia/Shanghai volumes: - ./mysql/conf/my.cnf:/etc/my.cnf - ./mysql/data:/var/lib/mysql:rw - ./mysql/logs:/var/log/mysql command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci --explicit_defaults_for_timestamp=true --default-time-zone=+8:00 --lower_case_table_names=1 ports: - 3306:3306 es: container_name: es hostname: es image: elasticsearch:7.1.1 restart: always ports: - 9200:9200 - 9300:9300 environment: - "ES_JAVA_OPTS=-Xmx2048m -Xmx2048m" #设置使用jvm内存大小 - "discovery.type=single-node" #以单一节点模式启动 - "cluster.name=elasticsearch" #设置集群名称为elasticsearch - TAKE_FILE_OWNERSHIP=true #volumes 挂载权限问题 不加上会报java虚拟机错误 - "ELASTIC_PASSWORD=elastic" # elastic账号密码(密码不要带@) volumes: - ./es-kibana/es/master/conf/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml - ./es-kibana/es/master/data:/usr/share/elasticsearch/data - ./es-kibana/es/master/logs:/usr/share/elasticsearch/logs networks: - byfn kibana: container_name: kibana hostname: kibana image: kibana:7.1.1 restart: always ports: - 5601:5601 volumes: - ./es-kibana/kibana/kibana.yml:/usr/share/kibana/config/kibana.yml environment: - elasticsearch.hosts=http://10.0.171.103:9200 depends_on: - es networks: - byfn mysql5: image: mysql:5.7 restart: always #重启docker引擎后该容器也重启 container_name: mysql5 hostname: mysql5 environment: MYSQL_ROOT_PASSWORD: 1qazXSW@ TZ: Asia/Shanghai volumes: - ./mysql5/conf/my.cnf:/etc/my.cnf - ./mysql5/data:/var/lib/mysql:rw - ./mysql5/logs:/var/log/mysql command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci --explicit_defaults_for_timestamp=true --default-time-zone=+8:00 --lower_case_table_names=1 ports: - 3307:3306 networks: - byfn mssql: image: mcr.microsoft.com/mssql/server:2017-latest restart: always #重启docker引擎后该容器也重启 container_name: mssql privileged: true ports: - "1433:1433" environment: - ACCEPT_EULA=Y - SA_PASSWORD=1qazXSW@ - TZ=Asia/Shanghai volumes: - ./mssql/data:/var/opt/mssql networks: - byfn oracle: image: oracleinanutshell/oracle-xe-11g restart: always #重启docker引擎后该容器也重启 container_name: oracle privileged: true ports: - "1521:1521" - "8090:8080" environment: - TZ=Asia/Shanghai volumes: - ./oracle/data:/u01/app/oracle/product/11.2.0/xe/oradata
- 1、登录物理机执行权限
- chmod 777 /opt/mssql/data/LAHB_0.ldf
- chmod 777 /opt/mssql/data/LAHB.mdf
-
- 2、进入Docker执行还原命令
- docker exec -it mssql /bin/bash
- /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 1qazXSW@
- >EXEC sp_attach_db @dbname = 'LAHB',
- >@filename1 = '/var/opt/mssql/data/LAHB_0.ldf',
- >@filename2 = '/var/opt/mssql/data/LAHB.mdf'
- >GO
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。