Games-and-Simulations / sc-docker

Multi-platform Version of StarCraft: Brood War in a Docker Container, ready to use for bot play simulations.
MIT License
230 stars 41 forks source link

Failure to create network sc_net #85

Open cij11 opened 5 years ago

cij11 commented 5 years ago

expected behaviour

On running

sudo scbw.play --bots "PurpleWave" --human

a game is created.

actual behaviour

On running

sudo scbw.play --bots "PurpleWave" --human

the following exception is raised:

INFO checking docker can run INFO checking whether docker has network sc_net INFO network not found, creating ... Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/docker/api/client.py", line 261, in _raise_for_status response.raise_for_status() File "/home/chris/.local/lib/python3.6/site-packages/requests/models.py", line 940, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: http+docker://localhost/v1.35/networks/create

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/bin/scbw.play", line 10, in sys.exit(main()) File "/usr/local/lib/python3.6/dist-packages/scbw/cli.py", line 209, in main install() File "/usr/local/lib/python3.6/dist-packages/scbw/install.py", line 17, in install ensure_local_net() File "/usr/local/lib/python3.6/dist-packages/scbw/docker_utils.py", line 80, in ensure_local_net DOCKER_STARCRAFT_NETWORK, ipam=ipam_config).short_id File "/usr/local/lib/python3.6/dist-packages/docker/models/networks.py", line 154, in create resp = self.client.api.create_network(name, *args, **kwargs) File "/usr/local/lib/python3.6/dist-packages/docker/api/network.py", line 152, in create_network return self._result(res, json=True) File "/usr/local/lib/python3.6/dist-packages/docker/api/client.py", line 267, in _result self._raise_for_status(response) File "/usr/local/lib/python3.6/dist-packages/docker/api/client.py", line 263, in _raise_for_status raise create_api_error_from_http_exception(e) File "/usr/local/lib/python3.6/dist-packages/docker/errors.py", line 31, in create_api_error_from_http_exception raise cls(e, response=response, explanation=explanation) docker.errors.APIError: 403 Client Error: Forbidden ("Pool overlaps with other one on this address space") `

steps to reproduce

Install docker, python3.6, and scbw as per the INSTALL.md

Run sudo scbw.play --bots "PurpleWave" --human

Please run the command issued with --log_level=DEBUG --log_verbose parameters and log:

chris@chris-Aspire-VN7-593G:~$ sudo scbw.play --bots "PurpleWave" --human --log_level=DEBUG --log_verbose 2019-05-12 21:48:48 DEBUG docker.utils.config[5921] Trying paths: ['/home/chris/.docker/config.json', '/home/chris/.dockercfg'] 2019-05-12 21:48:48 DEBUG docker.utils.config[5921] Found file at path: /home/chris/.docker/config.json 2019-05-12 21:48:48 DEBUG docker.auth[5921] Found 'auths' section 2019-05-12 21:48:48 DEBUG docker.auth[5921] Found entry (registry='https://index.docker.io/v1/', username='chrisjolly25') 2019-05-12 21:48:48 INFO scbw.docker_utils[5921] checking docker can run 2019-05-12 21:48:49 DEBUG scbw.docker_utils[5921] using docker API version 1.38 2019-05-12 21:48:49 INFO scbw.docker_utils[5921] checking whether docker has network sc_net 2019-05-12 21:48:49 INFO scbw.docker_utils[5921] network not found, creating ... Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/docker/api/client.py", line 261, in _raise_for_status response.raise_for_status() File "/home/chris/.local/lib/python3.6/site-packages/requests/models.py", line 940, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: http+docker://localhost/v1.35/networks/create

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/bin/scbw.play", line 10, in sys.exit(main()) File "/usr/local/lib/python3.6/dist-packages/scbw/cli.py", line 209, in main install() File "/usr/local/lib/python3.6/dist-packages/scbw/install.py", line 17, in install ensure_local_net() File "/usr/local/lib/python3.6/dist-packages/scbw/docker_utils.py", line 80, in ensure_local_net DOCKER_STARCRAFT_NETWORK, ipam=ipam_config).short_id File "/usr/local/lib/python3.6/dist-packages/docker/models/networks.py", line 154, in create resp = self.client.api.create_network(name, *args, **kwargs) File "/usr/local/lib/python3.6/dist-packages/docker/api/network.py", line 152, in create_network return self._result(res, json=True) File "/usr/local/lib/python3.6/dist-packages/docker/api/client.py", line 267, in _result self._raise_for_status(response) File "/usr/local/lib/python3.6/dist-packages/docker/api/client.py", line 263, in _raise_for_status raise create_api_error_from_http_exception(e) File "/usr/local/lib/python3.6/dist-packages/docker/errors.py", line 31, in create_api_error_from_http_exception raise cls(e, response=response, explanation=explanation) docker.errors.APIError: 403 Client Error: Forbidden ("Pool overlaps with other one on this address space")

operating system

Ubuntu lsb_release -a:

Distributor ID: Ubuntu Description: Ubuntu 18.04.1 LTS Release: 18.04 Codename: bionic

docker version

output of command docker version:

Client: Version: 18.09.2 API version: 1.38 (downgraded from 1.39) Go version: go1.10.4 Git commit: 6247962 Built: Tue Feb 26 23:52:23 2019 OS/Arch: linux/amd64 Experimental: false

Server: Engine: Version: 18.06.1-ce API version: 1.38 (minimum version 1.12) Go version: go1.10.4 Git commit: e68fc7a Built: Tue May 7 17:57:34 2019 OS/Arch: linux/amd64 Experimental: false

scbw version

output of command scbw.play -v

1.0.4

cij11 commented 5 years ago

Workaround: create network manually with: docker network create sc_net

JonghunBok commented 4 years ago

Do you use daemon.json to set the default bip? I found out that the script that tries to create the sc_net network does so using SUBNET_CIDR = "172.18.0.0/16". It seems if you're using the default bip with a higher number in the second octet, then docker engine refuses to make a network with that subnet cidr configuration. So, if you can't change the default bip, the workaround above seems to be the way to go.