-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to configure multiple domain (virtual host) and multiple virtual port #1463
Comments
I don't think multiple services in the same container are supported at the moment. A workaround might be to have "dummy" containers for each additional port, that do nothing but forward all connections to the second port. |
I have the same problem for this issue. My container run Nexus Repository in first port. It enable docker private repository in second port. I can't assign 2 domain by nexus-proxy. Some app listen multiple port Ex:
I think, one container running one service but listen single port is not always correct. |
@jwilder please help. |
@jakata007 @first087: # start the nginx proxy
docker run -d -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock:ro \
--name my-nginx-proxy --network=mynetwork jwilder/nginx-proxy
# start the application container, take note that:
# - it is named (so that the proxies below can see it)
# - it does not have anything exposed
docker run -d --network=mynetwork --name myapp application-with-two-ports
# For each port that you want to expose, configure a pseudo container.
# These only forward to the 'myapp' container above.
# They are additionally labeled for 'nginx-proxy' to pick up on.
docker run -d --network=mynetwork -e VIRTUAL_PORT=80 -e VIRTUAL_HOST=a.mydomain \
-e REMOTE_HOST=myapp -e REMOTE_PORT=81 marcnuri/port-forward
docker run -d --network=mynetwork -e VIRTUAL_PORT=80 -e VIRTUAL_HOST=b.mydomain \
-e REMOTE_HOST=myapp -e REMOTE_PORT=82 marcnuri/port-forward Disclaimer: CMD socat tcp-listen:$LOCAL_PORT,reuseaddr,fork tcp:$REMOTE_HOST:$REMOTE_PORT Also, I doubt @jwilder is currently developing new features, see #1304 (comment). |
Many thanks for that workaround @tkw1536 , I was about to setup another registry / nexus just for 1 customer to achieve this. |
I have run your image with command below.
my software run in single container and listen on port
81
,82
81
designed for domaina.mydomain
82
designed for domainb.mydomain
case 1, I have use these command. It's work.
docker run -d --network=mynetwork -e VIRTUAL_PORT=81 -e VIRTUAL_HOST=a.mydomain myimage
case 2, I have use these command. It's work.
docker run -d --network=mynetwork -e VIRTUAL_PORT=82 -e VIRTUAL_HOST=b.mydomain myimage
Question, how to configure for the following situation?
I would like to use port
81
with domaina.mydomain
and port82
with domainb.mydomain
in single container.I have tried with the following command. It 's not work.
docker run -d --network=mynetwork -e VIRTUAL_PORT=81,82 -e VIRTUAL_HOST=a.mydomain,b.mydomain myimage
Please help.
Thanks you.
The text was updated successfully, but these errors were encountered: