Docker Compose服务无法从localhost访问

时间:2019-06-14 13:56:33

标签: docker docker-compose localhost port

我有以下docker-compose文件:

version: '3.6'

services:
    mysql:
        image: mysql:5.7
        volumes:
            - "${DOCKER_VOLUMES_PATH}/mysql:/var/lib/mysql:cached"
        command: --sql_mode="NO_ENGINE_SUBSTITUTION"
        ports:
            - 3306:3306
        environment:
            - MYSQL_DATABASE=mcoins
            - MYSQL_USER=mcoins
            - MYSQL_PASSWORD=mcoins
            - MYSQL_ROOT_PASSWORD=mcoins
        restart: always
        networks:
            - development

    redis:
        image: redis:3.2-alpine
        volumes:
            - "${DOCKER_VOLUMES_PATH}/redis:/data:cached"
        ports:
            - 5379:5379
        restart: always
        networks:
            - development

networks:
    development:

当我尝试从无法正常工作的计算机访问localhost:3306或localhost:5379时

这是我从docker ps得到的:

docker ps command

0 个答案:

没有答案