gravitl / netmaker

Netmaker makes networks with WireGuard. Netmaker automates fast, secure, and distributed virtual networks.
https://netmaker.io
Other
9.5k stars 552 forks source link

"host" network_mode is incompatible with port_bindings #445

Closed prb-123 closed 3 years ago

prb-123 commented 3 years ago

Getting the Error: "host" network_mode is incompatible with port_bindings during install on Ubuntu 21.10 Likely this issue: https://forums.docker.com/t/docker-errors-invalidargument-host-network-mode-is-incompatible-with-port-bindings/103492/14

Full error:

root@wireguard:~# sudo wget -qO - https://raw.githubusercontent.com/gravitl/netmaker/develop/scripts/nm-quick.sh | bash checking for root permissions... setting flags... checking for root permissions... checking dependencies... docker.io is installed docker-compose is installed wireguard is installed jq is installed

            SETUP ARGUMENTS

    domain: nm.**********.nip.io
     email: nm.*********.nip.io
coredns ip: *****************
 public ip: **************
master key: *************

setup mesh?: true setup vpn?: false

setting caddyfile... setting docker-compose... starting containers... caddy is up-to-date Creating netmaker ...

ERROR: for netmaker "host" network_mode is incompatible with port_bindings

ERROR: for netmaker "host" network_mode is incompatible with port_bindings Traceback (most recent call last): File "/usr/bin/docker-compose", line 33, in sys.exit(load_entry_point('docker-compose==1.27.4', 'console_scripts', 'docker-compose')()) File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 67, in main command() File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 126, in perform_command handler(command, command_options) File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 1070, in up to_attach = up(False) File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 1051, in up return self.project.up( File "/usr/lib/python3/dist-packages/compose/project.py", line 643, in up results, errors = parallel.parallel_execute( File "/usr/lib/python3/dist-packages/compose/parallel.py", line 108, in parallel_execute raise error_to_reraise File "/usr/lib/python3/dist-packages/compose/parallel.py", line 206, in producer result = func(obj) File "/usr/lib/python3/dist-packages/compose/project.py", line 625, in do return service.execute_convergence_plan( File "/usr/lib/python3/dist-packages/compose/service.py", line 557, in execute_convergence_plan return self._execute_convergence_create( File "/usr/lib/python3/dist-packages/compose/service.py", line 471, in _execute_convergence_create containers, errors = parallel_execute( File "/usr/lib/python3/dist-packages/compose/parallel.py", line 108, in parallel_execute raise error_to_reraise File "/usr/lib/python3/dist-packages/compose/parallel.py", line 206, in producer result = func(obj) File "/usr/lib/python3/dist-packages/compose/service.py", line 476, in lambda service_name: create_and_start(self, service_name.number), File "/usr/lib/python3/dist-packages/compose/service.py", line 455, in create_and_start container = service.create_container(number=n, quiet=True) File "/usr/lib/python3/dist-packages/compose/service.py", line 328, in create_container container_options = self._get_container_create_options( File "/usr/lib/python3/dist-packages/compose/service.py", line 934, in _get_container_create_options container_options['host_config'] = self._get_container_host_config( File "/usr/lib/python3/dist-packages/compose/service.py", line 1009, in _get_container_host_config return self.client.create_host_config( File "/usr/lib/python3/dist-packages/docker/api/container.py", line 598, in create_host_config return HostConfig(*args, **kwargs) File "/usr/lib/python3/dist-packages/docker/types/containers.py", line 338, in init raise host_config_incompatible_error( docker.errors.InvalidArgument: "host" network_mode is incompatible with port_bindings

afeiszli commented 3 years ago

Thanks for catching this. We typically use 20.04, and it looks like the docker-compose version for 20.04 will ignore the port bindings (they dont end up getting used with host networking). I just pushed a change that should fix this.

prb-123 commented 3 years ago

Worked!