carlosvin / carlosvin.github.io

Carlos Martín Sánchez personal blog
https://carlosvin.github.io
4 stars 0 forks source link

Multi-Domain Docker Containers #40

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

Multi-Domain Docker Containers

How to create different Docker containers with different domain names in the same host

https://carlosvin.github.io/posts/reverse-proxy-multidomain-docker/en/

parveenLily commented 3 years ago

Hi, Tried to run your example app but the page does not load.BTW i am running docker desktop on windows machine and chnaged the hostfile as described.

This page isn’t workinglocalhost didn’t send any data. ERR_EMPTY_RESPONSE

carlosvin commented 3 years ago

Hi, how did you try to load the page? are you calling to b.domain.com? If you use localhost it won't work.

Christian-Rinne commented 3 years ago

@parveenLily

you have to set permissions in docker desktop settings to your application folder where your pages are :-)

fdbatista commented 3 years ago

Hi @carlosvin

I am trying to run the example, but I get the following output from docker-compose up:

ERROR: for docker-reverse-proxy-multi-domain_nginx-proxy_1  Cannot start service nginx-proxy: OCI runtime create failed: container_linux.go:370: starting container process caused: process_linux.go:459: container init caused: process_linux.go:422: setting cgroup config for procHooks process caused: resultingStarting docker-reverse-proxy-multi-domain_b_1           ... done

ERROR: for nginx-proxy  Cannot start service nginx-proxy: OCI runtime create failed: container_linux.go:370: starting container process caused: process_linux.go:459: container init caused: process_linux.go:422: setting cgroup config for procHooks process caused: resulting devices cgroup doesn't match target mode: unknown

Any idea why this might be happening?

carlosvin commented 3 years ago

Hi @fdbatista, have you tried to run it with sudo?

fdbatista commented 3 years ago

Hi @fdbatista, have you tried to run it with sudo?

Not really, since the OS user is allowed to execute docker commands, but I can give it a try.

fdbatista commented 3 years ago

Hi @fdbatista, have you tried to run it with sudo?

image

@carlosvin Same error, running docker-compose with sudo.

carlosvin commented 3 years ago

Sorry I can't help more @fdbatista, I can't reproduce your issue. I've tried in Archlinux and Mac Catalina, and it works as expected. Out of curiosity, what Linux distro are you using? Maybe someone else reports the same issue.

fdbatista commented 3 years ago

@carlosvin This is my environment:

OS: Ubuntu 20.04.1 LTS Docker: Docker version 19.03.12, build 48a66213fe Compose: docker-compose version 1.25.0, build unknown

freshstartagain commented 6 months ago

Is it possible to do the same setup with custom conf.template for each containers?

150170410 commented 5 months ago

How could I configure Ngnix reverse proxy if I want to

http://IP/appA >>> go to http://10.20.30.40:8080/ (appA) http://IP/appB >>> go to http://10.20.30.40:8081/ (appB) http://IP/appC >>> go to http://10.20.30.40:8082/ (appC) http://IP/appD >>> go to http://10.20.30.40:8083/ (appD)

In this case?
Thanks