canarytrace / documentation

Plug’n'Play stack for testing and monitoring web applications from user perspective.
http://canarytrace.com
6 stars 0 forks source link

Docker-compose - "host" network_mode is incompatible with port_bindings #45

Closed zarofka closed 3 years ago

zarofka commented 3 years ago

Describe the bug Building with native build. Learn about native build in Compose here: https://docs.docker.com/go/compose-native-build/ Creating docker_compose_browser_1 ...

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

ERROR: for browser "host" network_mode is incompatible with port_bindings Traceback (most recent call last): File "docker-compose", line 3, in 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 563, in execute_convergence_plan File "compose/service.py", line 479, in _execute_convergence_create File "compose/parallel.py", line 106, in parallel_execute File "compose/parallel.py", line 204, in producer File "compose/service.py", line 477, in File "compose/service.py", line 456, in create_and_start 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 [4043] Failed to execute script docker-compose

Deployment / CronJob / CLI command / Docker compose

version: "3.8"
services:
  browser:
    image: selenium/standalone-chrome:3.141.59-20200730
    ports:
      - "4444:4444"
    network_mode: "host"
    volumes:
      - /dev/shm:/dev/shm
  canarytrace:
    image: quay.io/canarytrace/smoke:3.0.5
    depends_on:
      - browser
    network_mode: "host"
    environment:
      BASE_URL: 'https://canarytrace.com/;https://www.teststack.cz/'
      ELASTIC_CLUSTER: http://localhost:9200

Expected behavior Run Canarytrace Smoke

Environment information: Description: Ubuntu 20.04.2 LTS docker-compose version 1.28.2, build 67630359 docker-py version: 4.4.1 CPython version: 3.7.9 OpenSSL version: OpenSSL 1.1.0l 10 Sep 2019

zarofka commented 3 years ago

Solution: downgrade docker-compose utility to version: 1.27.4, build 40524192

https://forums.docker.com/t/docker-errors-invalidargument-host-network-mode-is-incompatible-with-port-bindings/103492

zarofka@ubuntu:~/docker_compose# docker-compose up
Creating docker_compose_browser_1 ... done
Creating docker_compose_canarytrace_1 ... done
Attaching to docker_compose_browser_1, docker_compose_canarytrace_1
canarytrace_1  | Smoke start
browser_1      | 2021-02-05 12:18:14,648 INFO Included extra file "/etc/supervisor/conf.d/selenium.conf" during parsing
browser_1      | 2021-02-05 12:18:14,655 INFO supervisord started with pid 9
browser_1      | 2021-02-05 12:18:15,660 INFO spawned: 'xvfb' with pid 12
browser_1      | 2021-02-05 12:18:15,662 INFO spawned: 'selenium-standalone' with pid 13
browser_1      | 2021-02-05 12:18:16,663 INFO success: xvfb entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
browser_1      | 2021-02-05 12:18:16,664 INFO success: selenium-standalone entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
browser_1      | 12:18:16.712 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358
browser_1      | 12:18:16.901 INFO [GridLauncherV3.lambda$buildLaunchers$3] - Launching a standalone Selenium Server on port 4444
browser_1      | 2021-02-05 12:18:17.999:INFO::main: Logging initialized @1240ms to org.seleniumhq.jetty9.util.log.StdErrLog
browser_1      | 12:18:17.501 INFO [WebDriverServlet.<init>] - Initialising WebDriverServlet
browser_1      | 12:18:17.673 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444
canarytrace_1  |
canarytrace_1  | Execution of 1 spec files started at 2021-02-05T12:18:18.147Z
canarytrace_1  |
canarytrace_1  | [0-0] List: https://www.tesla.com/,https://www.rouming.com/
canarytrace_1  | [0-0] RUNNING in chrome - /smoke/smoke.js
browser_1      | 12:18:20.729 INFO [ActiveSessionFactory.apply] - Capabilities are: {
browser_1      |   "browserName": "chrome",
browser_1      |   "goog:chromeOptions": {
browser_1      |     "args": [
browser_1      |       "--remote-debugging-port=9222",
browser_1      |       "--remote-debugging-host=0.0.0.0",
browser_1      |       "--start-fullscreen",
browser_1      |       "--disable-notifications",
browser_1      |       "--window-size=1920,1080"
browser_1      |     ]
browser_1      |   }
browser_1      | }
browser_1      | 12:18:20.732 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.grid.session.remote.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
browser_1      | Starting ChromeDriver 84.0.4147.30 (48b3e868b4cc0aa7e8149519690b6f6949e110a8-refs/branch-heads/4147@{#310}) on port 6031
browser_1      | Only local connections are allowed.
browser_1      | Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
browser_1      | ChromeDriver was started successfully.
browser_1      | 12:18:23.346 INFO [ProtocolHandshake.createSession] - Detected dialect: W3C
browser_1      | 12:18:23.380 INFO [RemoteSession$Factory.lambda$performHandshake$0] - Started new session 875c79255f33d0ace74d0eddda0f6e7e (org.openqa.selenium.chrome.ChromeDriverService)
canarytrace_1  | [0-0] testStepStart: Smoke setup
canarytrace_1  | [0-0] testStepEnd: Smoke setup (8 ms)
canarytrace_1  | [0-0] Canarytrace:entries: 1
canarytrace_1  | [0-0] Canarytrace:elastic:bucket c.performance-entries-2021.02.05 (bulk 1) Elastic process time: 240 ms
canarytrace_1  | [0-0] testStepStart: Smoke https://www.tesla.com/
canarytrace_1  | [0-0] testStepEnd: Smoke https://www.tesla.com/ (2643 ms)
canarytrace_1  | [0-0] Canarytrace:entries: 33
canarytrace_1  | [0-0] Canarytrace:elastic:bucket c.performance-entries-2021.02.05 (bulk 33) Elastic process time: 135 ms
browser_1      | 12:18:27.690 INFO [ActiveSessions$1.onStop] - Removing session 875c79255f33d0ace74d0eddda0f6e7e (org.openqa.selenium.chrome.ChromeDriverService)
canarytrace_1  | [0-0] PASSED in chrome - /smoke/smoke.js
canarytrace_1  |
canarytrace_1  |  "spec" Reporter:
canarytrace_1  | ------------------------------------------------------------------
canarytrace_1  | [chrome 84.0.4147.105 linux #0-0] Spec: /opt/canary/smoke/smoke.js
canarytrace_1  | [chrome 84.0.4147.105 linux #0-0] Running: chrome (v84.0.4147.105) on linux
canarytrace_1  | [chrome 84.0.4147.105 linux #0-0] Session ID: 875c79255f33d0ace74d0eddda0f6e7e
canarytrace_1  | [chrome 84.0.4147.105 linux #0-0]
canarytrace_1  | [chrome 84.0.4147.105 linux #0-0] Smoke
canarytrace_1  | [chrome 84.0.4147.105 linux #0-0]    ✓ setup
canarytrace_1  | [chrome 84.0.4147.105 linux #0-0]    ✓ https://www.tesla.com/
canarytrace_1  | [chrome 84.0.4147.105 linux #0-0]
canarytrace_1  | [chrome 84.0.4147.105 linux #0-0] 2 passing (3s)
canarytrace_1  |
canarytrace_1  |
canarytrace_1  | Spec Files:     1 passed, 1 total (100% completed) in 00:00:09
canarytrace_1  |
docker_compose_canarytrace_1 exited with code 0
rdpanek commented 3 years ago

@zarofka thanks 👌