Q: How to change Python default version in Docker? I am using aws ec2 Ubuntu Server 20.04 LTS and having trouble with Python and Docker.
The python default version on ec2 is Python 3.8.5. I have also installed Python version 2.7.18.
But when I run docker or my complete network, docker is using the default version, which is python 3.8.5. So this causes errors for all peers, oderer and couchdb e.g.
ERROR: for ca_peerOrg2  a bytes-like object is required, not 'str'

ERROR: for orderer.example.com  a bytes-like object is required, not 'str'

ERROR: for orderer4.example.com  a bytes-like object is required, not 'str'

and also the following error
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.22/containers/26d88164408dec7c247e07d47f803fd3767731bb0cf9748d9d0285de89c1f49f/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'driver failed programming external connectivity on endpoint couchdb3 (4cc5.....): Bind for 0.0.0.0:8984 failed: port is already allocated'")

I found a solution here, which I couldn't apply to mine.
Do you know, how I can change it, so that my docker runs without the errors? Thank you.
