0

I’ve rebooted my system and then run all my containers using the vendor/bin/sail up command, the only one that failed to reload was MySQL. The error is the following :

ERROR: for mysql  a bytes-like object is required, not 'str'
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/docker/api/client.py", line 261, in _raise_for_status
    response.raise_for_status()
  File "/usr/lib/python3/dist-packages/requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: http+docker://localhost/v1.25/containers/afdd1cbf7f45d9b20612bca
f73eef1b0bc1dd631bc6aa3dcfbf630c64e8a3662/start

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/compose/service.py", line 625, in start_container
    container.start()
  File "/usr/lib/python3/dist-packages/compose/container.py", line 241, in start
    return self.client.start(self.id, **options)
  File "/usr/lib/python3/dist-packages/docker/utils/decorators.py", line 19, in wrapped
    return f(self, resource_id, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/docker/api/container.py", line 1095, in start
    self._raise_for_status(res)
  File "/usr/lib/python3/dist-packages/docker/api/client.py", line 263, in _raise_for_status
    raise create_api_error_from_http_exception(e)
  File "/usr/lib/python3/dist-packages/docker/errors.py", line 31, in create_api_error_from_http_exception
    raise cls(e, response=response, explanation=explanation)
docker.errors.APIError: 500 Server Error: Internal Server Error ("b'Ports are not available: listen tcp 0.0.0.0:3306: bind: An attempt was made
to access a socket in a way forbidden by its access permissions.'")


I’m running this container on ubuntu server 20.04.

Ahmad Azizi
  • 21
  • 1
  • 5
  • 1
    I'm not sure why the error isn't being reported well, but the final error in the last line looks like a Windows error, not something you'd see on Ubuntu. [Docker SQL bind: An attempt was made to access a socket in a way forbidden by its access permissions](https://stackoverflow.com/q/57316744/10008173) and [Ports are not available: listen tcp 0.0.0.0/50070: bind: An attempt was made to access a socket in a way forbidden by its access permissions](https://stackoverflow.com/q/65272764/10008173) have some suggestions, but they're Windows-specific. – David Maze Apr 03 '21 at 12:13

2 Answers2

0

It might fix the problem if you provide an absolute path to your nginx/mysql conf file. I haven't tried the solution yet.

Yunnosch
  • 26,130
  • 9
  • 42
  • 54
Yoweli Kachala
  • 423
  • 6
  • 13
0

Check if your ports are in use. I had the same issue, I have changed the ports and then it was working without any problem.

Check for used ports:

sudo lsof -i -P -n | grep LISTEN
Herr Nentu'
  • 1,438
  • 3
  • 18
  • 49