Trying to setup an nginx-proxy container for other containers particularly nodejs apps using docker-compose.
I am following the tutorial in this blog. According to the tutorial once the nginx-proxy and let'sencrypt is setup the other apps need the docker-compose.yml file like so to work with the proxy:
version: '3' services: example-app: image: example/example-app expose: - 80 environment: VIRTUAL_HOST: app.example.com LETSENCRYPT_HOST: app.example.com LETSENCRYPT_EMAIL: firstname.lastname@example.org networks: default: external: name: nginx-proxy
For my nodejs app I’ve setup my docker-compose.yml file as follows:
version: '3' services: app: image: node:carbon expose: - 80 volumes: - .:/home/path/to/code environment: VIRTUAL_HOST: app.example.com LETSENCRYPT_HOST: app.example.com LETSENCRYPT_EMAIL: email@example.com command: npm start networks: default: external: name: nginx-proxy
I’ve setup simple package.json and index.js files to run a Hello World app. I run
docker-compose up -d, which runs without issues and adds the website. However, when I go to the domain, I get an nginx 503 error. I was wondering if anyone could help point me in the right direction, or maybe even take a different approach to this problem if needed.