Docker Community Forums

Share and learn in the Docker community.

Why cannot connect to container port from browser on host?

beta

(Kiyugadgeter) #1

I want to connect to port of container from browser on host with port 1344.
But Connection be fail when I accessed http://localhost:1344.
Why cannot connect to 1344 in spite of expose port?

And, http://localhost:8080 connection is correctly, But localhost:1344 has fail.

Why cannot connect to 1344?

The following are my docker-compose.yml and dockerfile.

I am using docker 1.12.0-rc4-beta19 on Mac.

docker-compose.yml:

version: '2'
services:
    datastore:
        image: busybox:latest
        volumes:
            - ./share:/share_to_container

    ### base (ubuntu)
    base:
        build: ./
        ports:
            - "1344:1344"
            - "8000:8000"
        volumes:
            - ./app:/app
        volumes_from:
            - datastore
        links:
            - db
            - webserver


    db:
        build: 
            context: .
            dockerfile: "mysqlfile"
        environment:
            - MYSQL_ROOT_PASSWORD=hello
        ports:
            - "3306:3306"
        volumes:
            - ./mysql:/mysql
        volumes_from:
            - datastore

    webserver:
        image: nginx
        ports:
            - "8080:80"
        volumes:
            - ./nginx/mysite.template:/etc/nginx/conf.d/mysite.template
        volumes_from:
            - datastore

Dockerfile_for_base:
EXPOSE 1344