angularjs - Environment variable in Docker -


i have app working in 2 containers. nodejs , nginx -container. working together. in code of developer src / app / app.config.js

(function () {   'use strict';    angular     .module('app')     .constant('config', {       url: 'http://localhost',       port: '8888',      }); })(); 

the url , port fine in case of developer. see app, after building locally. doing? have jenkins performing npm-install, gulp build etc. after build. right generated folders copied dockerfiles (one nginx , 1 nodejs). after can start containers command:

docker run --restart=always -d --name "nodejs" our-nodejs-image:11  docker run --restart=always -d -p 80:80 --name nginx --link nodejs:nodejs our-nginx-image:11 

the main problem following. url , port have change. example we're running our containers on ec2-123:80 have change url ec2-123 , port 80 (because nginx working reverse proxy our nodejs).

so in case losing advantage of docker (running image on each environment). need environment variable can describe when we're performing docker run command. , variables needs input of url: , port:.

so run command nginx needs :

docker run -e "url: ec123" -e "port:80" --restart=always -d -p 80:80 --name nginx --link nodejs:nodejs our-nginx-image:11 


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -