mysqldbtest:
restart: always
ports:
- ‘3306:3306/tcp‘
environment:
- MYSQL_MAJOR=5.7
- MYSQL_ROOT_PASSWORD=×××××
- MYSQL_DATABASE=ghost
- MYSQL_USER=ghost
- MYSQL_PASSWORD=ghost
memswap_limit: 0
labels:
aliyun.scale: ‘1‘
shm_size: 0
image: ‘mysql:latest‘
memswap_reservation: 0
volumes:
- /var/lib/mysql
kernel_memory: 0
mem_limit: 0
ghost:
restart: always
ports:
- ‘2368:2368/tcp‘
environment:
- GHOST_MYSQL_HOST=mysqldb
- GHOST_MYSQL_USER=ghost
- GHOST_MYSQL_PASSWORD=×××××
- GHOST_MYSQL_DATABASE=ghost
- GHOST_MYSQL_PORT=3306
- GHOST_ROOT_URL=http://URL
memswap_limit: 0
labels:
aliyun.scale: ‘1‘
shm_size: 0
image: ‘index.tenxcloud.com/tenxcloud/ghost:latest‘
memswap_reservation: 0
kernel_memory: 0
mem_limit: 0
name: ghost
docker run -d -e MYSQL_ROOT_PASSWORD=***** -e MYSQL_USER=*** -e MYSQL_PASSWORD=**** -e MYSQL_DATABASE=**** -p 3306:3306 -v --restart=always --name mysqldb mysql
docker run -d -e GHOST_MYSQL_HOST=*** -e GHOST_MYSQL_USER=*** -e GHOST_MYSQL_PASSWORD=**** -v --restart=always -e GHOST_MYSQL_DATABASE=*** -p 80:2368 --name myghost ghost
原文地址:http://blog.51cto.com/linuxmaizi/2088846