-
Notifications
You must be signed in to change notification settings - Fork 330
Support macvlan network #795
Comments
@giggio we have never used macvlan mode with Docker, so yes - currently Selenoid does not support macvlan I think. |
I was able to get it to work with a workaround. I added solenoid to both networks. This is my docker-compose.yaml ( version: '3.7'
services:
selenoid:
build:
context: .
dockerfile: Dockerfile.selenoid
image: lambda3/selenoid
container_name: selenoid
environment:
- TZ=America/Sao_Paulo
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./config/:/etc/selenoid/:ro
restart: always
command: [ "-listen", ":4444", "-conf", "/etc/selenoid/browsers.json", "-video-output-dir", "/opt/selenoid/video/", "-container-network", "selenoidnet" ]
ports:
- "4444:4444" # unnecessary, but needed because of selenoid
networks:
lan_net:
ipv4_address: 10.237.107.246
selenoidnet: {}
selenoidui:
build:
context: .
dockerfile: Dockerfile.selenoidui
image: lambda3/selenoidui
container_name: selenoidui
environment:
- TZ=America/Sao_Paulo
restart: always
depends_on:
- selenoid
command: --selenoid-uri=http://selenoid:4444 --listen :80
networks:
lan_net:
ipv4_address: 10.237.107.245
selenoidnet: {}
networks:
lan_net:
external:
name: lan_net
selenoidnet:
external:
name: selenoidnet This works, and maybe there is nothing else you need to do, just maybe document it. The containers get created on a bridge network, which is fine, as we only need access to Solenoid and the UI, not the browser containers. I still need to test VNC etc, but this seems fine. |
@giggio ok, will document it. Thank you for clarification! |
Ok, I evolved it to a simpler design, adding a reverse nginx proxy. It could be a good alternative to the one I posted above. I leave all the selenoid machinery on one network, not a macvlan, and then I add an nginx proxy to both the selenoid network and the macvlan network. It worked perfectly. version: '3.7'
services:
selenoid:
build:
context: .
dockerfile: Dockerfile.selenoid
image: lambda3/selenoid
container_name: selenoid
environment:
- TZ=America/Sao_Paulo
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./config/:/etc/selenoid/:ro
restart: always
command: [ "-listen", ":4444", "-conf", "/etc/selenoid/browsers.json", "-video-output-dir", "/opt/selenoid/video/", "-container-network", "selenoidnet" ]
networks:
selenoidnet: null
selenoidui:
build:
context: .
dockerfile: Dockerfile.selenoidui
image: lambda3/selenoidui
container_name: selenoidui
environment:
- TZ=America/Sao_Paulo
restart: always
depends_on:
- selenoid
command: --selenoid-uri=http://selenoid:4444 --listen :80 -allowed-origin *
networks:
lan_net:
ipv4_address: 10.237.107.245
selenoidnet: null
selenoidproxy:
image: nginx:1.17-alpine
container_name: selenoidproxy
networks:
lan_net:
ipv4_address: 10.237.107.246
selenoidnet: null
environment:
- TZ=America/Sao_Paulo
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
- ./certs/lambda3.com.br.crt:/etc/ssl/lambda3.com.br.crt
- ./certs/lambda3.com.br.key:/etc/ssl/lambda3.com.br.key
restart: always
networks:
lan_net:
external:
name: lan_net
selenoidnet:
external:
name: selenoidnet |
@giggio before I add this to docs - could you please clarify what's the reason of using Macvlan networks in your case? According to docs it's mainly useful for legacy applications. |
Using a Macvlan net I am able to assign an ip address to the container that is different from the host. From there I can assign a name from a dns, work on firewall rules etc. |
Added FAQ section about macvlan network (fixes #795)
I am using a macvlan network on Docker, and I'm getting an error message:
On a Macvlan network all ports are exposed, but it seems that Selenoid is not able to understand that somehow.
This is the line that seems to be doing it:
selenoid/service/docker.go
Line 187 in db901aa
The text was updated successfully, but these errors were encountered: