docker-compose (鍗曟満鐗堢殑瀹瑰櫒缂栨帓宸ュ叿)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了docker-compose (鍗曟満鐗堢殑瀹瑰櫒缂栨帓宸ュ叿)相关的知识,希望对你有一定的参考价值。

鏍囩锛?a href='http://www.mamicode.com/so/1/pre' title='pre'>pre   serve   mes   some   database   user   restart   doc   root   

绫讳技浜巃nsible鍓ф湰 yml 鏍煎紡
瑕佷娇鐢ㄨ繖涓紪鎺掑伐鍏凤紝蹇呴』鍏堝畨瑁?br /> yum install -y docker-compose

cd wordpress/
vi docker-compose.yml
###############
version: '3'

services:
   db:
     image: mysql:5.7
     volumes:
       - /data/db_data:/var/lib/mysql
     restart: always
     environment:
       MYSQL_ROOT_PASSWORD: somewordpress
       MYSQL_DATABASE: wordpress
       MYSQL_USER: wordpress
       MYSQL_PASSWORD: wordpress

   wordpress:
     depends_on:
       - db
     image: wordpress:latest
     volumes:
       - /data/web_data:/var/www/html
     ports:
       - "80:80"
     restart: always
     environment:
       WORDPRESS_DB_HOST: db
       WORDPRESS_DB_USER: wordpress
       WORDPRESS_DB_PASSWORD: wordpress

###############

鍦ㄥ惈鏈塪ocker-compose.yml鐨勭洰褰曚笅鎵ц
docker-compose up -d

璁块棶缃戦〉锛屾鏌?/code>

浣跨敤docker-compose缂栨帓鏂瑰紡锛屽畨瑁厇abbix

vim docker-compose.yml
################
version: '3'

services:
   mysql-server:
     image: mysql:5.7
     restart: always
     command: --character-set-server=utf8 --collation-server=utf8_bin
     environment:
       MYSQL_ROOT_PASSWORD: root_pwd
       MYSQL_DATABASE: zabbix
       MYSQL_USER: zabbix
       MYSQL_PASSWORD: zabbix_pwd
   
   zabbix-java-gateway:
     image: zabbix/zabbix-java-gateway:latest
     restart: always 

   zabbix-server:
     depends_on:
       - mysql-server
       - zabbix-java-gateway
     image: zabbix/zabbix-server-mysql:latest
     ports:
       - "10051:10051"
     restart: always
     environment:
       DB_SERVER_HOST: mysql-server 
       MYSQL_DATABASE: zabbix 
       MYSQL_USER: zabbix 
       MYSQL_PASSWORD: zabbix_pwd 
       MYSQL_ROOT_PASSWORD: root_pwd 
       ZBX_JAVAGATEWAY: zabbix-java-gateway 

   zabbix-web:
     depends_on:
       - mysql-server
       - zabbix-server
     image: zabbix/zabbix-web-nginx-mysql:latest
     ports:
       - "80:80"
     restart: always
     environment:
       DB_SERVER_HOST: mysql-server 
       MYSQL_DATABASE: zabbix 
       MYSQL_USER: zabbix 
       MYSQL_PASSWORD: zabbix_pwd 
       MYSQL_ROOT_PASSWORD: root_pwd
################

鍦ㄥ惈鏈塪ocker-compose.yml鐨勭洰褰曚笅鎵ц
docker-compose up -d

璁块棶缃戦〉锛屾鏌?

以上是关于docker-compose (鍗曟満鐗堢殑瀹瑰櫒缂栨帓宸ュ叿)的主要内容,如果未能解决你的问题,请参考以下文章

ElasticSearch鍗曟満鍙屽疄渚嬬殑閰嶇疆鏂规硶

mongodb 4.2鍗曟満閮ㄧ讲

linux鍗曟満閮ㄧ讲kafka(filebeat+elk缁勫悎)

Spring瀹瑰櫒绠$悊瀵硅薄鍜宯ew瀵硅薄

java瀹瑰櫒鐨勪袱澶х被Collection鍜孧ap

绠€鍗曡В鏋怱pring鏍稿績IOC瀹瑰櫒鍘熺悊