How to connect my NodeJS with my Angular (in Nginx)

后端 未结 2 499
孤街浪徒
孤街浪徒 2021-01-07 03:09

I\'ve a repo with angular and nodejs. I performed in jenkins:

# install globally
npm install -g bower
npm install -g gulp

# install
bower install
npm insta         


        
2条回答
  •  臣服心动
    2021-01-07 03:29

    One solution is to link both containers as described in @manish's answer.

    But be aware that this is the legacy way of connecting containers together.


    From now on, you can use the new docker network feature to create a virtual network and connect both containers to that network:

    docker network create mynetwork
    docker run -d --net=mynetwork -p 8888:8888 --name "nodejs" localhost:5000/test/nodejs:1
    docker run -d --net=mynetwork -p 80:80 --name "nginx" localhost:5000/test/nginx:1
    

    With such a setup, your nginx config file must use

    server nodejs:8888 weight=10 max_fails=3 fail_timeout=30s;
    

    as you now refer to other container by their name.

提交回复
热议问题