node.js - Docker-Compose publishing ports on Host computer Nodejs + Express -


i have built docker-compose file , want access nodejs app on localhost:3000 host computer publishing ports doesn't seem working.

when run compose-up seems working fine , confirmation listening on port 3000. when go localhost:3000 browser curl not found or timeout response.

am missing here?

my nodejs server:

var server = app.listen( process.env.port || 3000, function(){   console.log('listening on port ' + server.address().port); }); 

my docker-compose.yml file:

version: "3" services:     api:       image: baum-test:v0       ports:         - "3000:3000"       networks:         - webnet     mongodb:      image: mongo:latest      ports:        - "27017:27017"      volumes:        - ./data:/data      deploy:        placement:          constraints: [node.role == manager]      networks:        - webnet networks:   webnet: 

if running using docker stack deploy command can "constraints: [node.role == manager]" in docker-compose.yml. if used docker-compose up command composition using swarm features of compose file on docker-compose. remove below section completely

 deploy:    placement:      constraints: [node.role == manager] 

Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -