tinkerbell / playground

Example deployments of the Tinkerbell Stack for use as playground environments
Apache License 2.0
132 stars 87 forks source link

Docker Compose: "host" network_mode is incompatible with port_bindings #53

Closed jmarhee closed 3 years ago

jmarhee commented 3 years ago

The following lines are in conflict: https://github.com/tinkerbell/sandbox/blob/58937939c36239e9fb3fb03b5e744f7d0249a9c4/deploy/docker-compose.yml#L117

and

https://github.com/tinkerbell/sandbox/blob/58937939c36239e9fb3fb03b5e744f7d0249a9c4/deploy/docker-compose.yml#L144-L147

Resulting in:

root@tinkerbell:~/sandbox-master/deploy# source ../.env; docker-compose up -d
Building with native build. Learn about native build in Compose here: https://docs.docker.com/go/compose-native-build/
deploy_db_1 is up-to-date
Recreating deploy_nginx_1 ...
deploy_registry_1 is up-to-date
Recreating 17fbb5905e81_deploy_boots_1 ...
deploy_hegel_1 is up-to-date
Recreating deploy_nginx_1                 ... done
ERROR: for 17fbb5905e81_deploy_boots_1  "host" network_mode is incompatible with port_bindings
Recreating deploy_tink-server-migration_1 ... done
Recreating deploy_tink-server_1           ... done
deploy_tink-cli_1 is up-to-date

ERROR: for boots  "host" network_mode is incompatible with port_bindings
Traceback (most recent call last):
  File "docker-compose", line 3, in <module>
  File "compose/cli/main.py", line 80, in main
  File "compose/cli/main.py", line 192, in perform_command
  File "compose/metrics/decorator.py", line 18, in wrapper
  File "compose/cli/main.py", line 1165, in up
  File "compose/cli/main.py", line 1161, in up
  File "compose/project.py", line 708, in up
  File "compose/parallel.py", line 106, in parallel_execute
  File "compose/parallel.py", line 204, in producer
  File "compose/project.py", line 694, in do
  File "compose/service.py", line 580, in execute_convergence_plan
  File "compose/service.py", line 502, in _execute_convergence_recreate
  File "compose/parallel.py", line 106, in parallel_execute
  File "compose/parallel.py", line 204, in producer
  File "compose/service.py", line 495, in recreate
  File "compose/service.py", line 614, in recreate_container
  File "compose/service.py", line 333, in create_container
  File "compose/service.py", line 937, in _get_container_create_options
  File "compose/service.py", line 1069, in _get_container_host_config
  File "docker/api/container.py", line 598, in create_host_config
  File "docker/types/containers.py", line 339, in __init__
docker.errors.InvalidArgument: "host" network_mode is incompatible with port_bindings
[512463] Failed to execute script docker-compose

From my reading of this container configuration, it seems like the network_mode: host line would be preferable to be removed. It seems to work either way (I tried this using both configurations and was able to complete a provisioning), but not totally sure what the prefered resolution might be if there are implications to either that I'm not considering. Thanks!

gianarb commented 3 years ago

Hello!! Thank you for reporting this. It is a duplicate of https://github.com/tinkerbell/sandbox/issues/53

if you want to help with that, please raise a PR!! we need a fix for that!

MeghnaW19 commented 3 years ago

What is the solution to this error? I'm also facing the same issue!