码头工人组成卷:./var:/var错误?

时间:2020-02-16 03:29:01

标签: docker docker-compose

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.6https://github.com/docker-library/mysql/blob/4ee6cf34697d33b2f71144ef55f96867b71220d5/5.6/Dockerfile

0 个答案:

没有答案