docker-compose.yml:
version: '3'
services:
mysql56:
image: mysql:5.6
container_name: mysql56
volumes:
# - ./mysql:/var/lib/mysql
- ./var:/var
ports:
- 3307:3306
- 33060:33060
environment:
TZ: Asia/Shanghai
MYSQL_ROOT_PASSWORD: 'root@123'
networks:
- shanhy-ci
networks:
shanhy-ci:
driver: bridge
运行:
docker-compose up
它输出错误:
Creating mysql56 ... error
...
merged/var/lib: file exists\\\"\"": unknown
ERROR: Encountered errors while bringing up the project.
但是如果我修改docker-compose.yml
:
volumes:
- ./mysql:/var/lib/mysql
# - ./var:/var
他可以正常工作,我不知道为什么,
为什么docker
有/var/lib/mysql
,却没有/var
?
image: mysql:5.6
:https://github.com/docker-library/mysql/blob/4ee6cf34697d33b2f71144ef55f96867b71220d5/5.6/Dockerfile