0

I have a typescript application which is in turn a express web application and uses ws module for socket operations.

My use case here is, I have to run the typescript application inside a LXC container in Ubuntu.

I have created a container using following steps,

lxc-create -t download -n my-container
lxc-start -n my-container -d
lxc-attach -n my-container

And I installed node inside the container using,

apt-get install wget unzip nodejs npm nodejs-legacy 

Now when I try to install express or typescript npm module, I am getting the following error,

root@myNodeCont:/# npm install -g express
npm http GET https://registry.npmjs.org/express
npm http GET https://registry.npmjs.org/express
npm http GET https://registry.npmjs.org/express
npm ERR! network tunneling socket could not be established, cause=4150015744:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:s23_clnt.c:795:
npm ERR! network
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

npm ERR! System Linux 4.15.0-45-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "express"
npm ERR! cwd /
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! code ECONNRESET
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /npm-debug.log
npm ERR! not ok code 0

It tells me I am behind a proxy, but I have no proxy configured on the container.

Is there something I am doing wrong here?

Is there any reference I can look up to on how to run a typescript application inside a container?

Any help is appreciated.

Shaik Syed Ali
  • 3,359
  • 3
  • 17
  • 22

1 Answers1

0

So, while installing those modules, container need to go to internet to fetch those modules.

Option1:

open resolv.conf file in lxc contianer.

sudo vi /etc/resolv.conf

add

name-servers 8.8.8.8 8.8.4.4

to the end of the file, now try installing all those modules.

Option2:

It's best to use Port-Forwarding

Write a iptable/ebtable rule such that any traffic which goes out from Base Machine should be forwarded to LXC Container's Interface.

RajNikhil Marpu
  • 397
  • 2
  • 4
  • 19