3
respostas

Erro ao executar o docker-compose up

Prezado(a)s, Boa tarde ! Preciso de uma ajuda em relação ao erro que estou tomando. Ao executar o docker-compose up, ocorre o erro abaixo.

paulo@ubuntuci:~/ci$ docker-compose up Traceback (most recent call last): File "/usr/bin/docker-compose", line 33, in sys.exit(load_entry_point('docker-compose==1.29.2', 'console_scripts', 'docker-compose')()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/bin/docker-compose", line 25, in importlib_load_entry_point return next(matches).load() ^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/importlib/metadata/init.py", line 205, in load module = import_module(match.group('module')) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/importlib/init.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1387, in _gcd_import File "", line 1360, in _find_and_load File "", line 1331, in _find_and_load_unlocked File "", line 935, in _load_unlocked File "", line 995, in exec_module File "", line 488, in _call_with_frames_removed File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 9, in from distutils.spawn import find_executable ModuleNotFoundError: No module named 'distutils'

Em tempo.... vi algumas reclamações no forum, e gozo da mesma opinião de alguns quanto ao curso. Legal aproveitar um projeto de um outro curso, mas infelizmente isso não está legal nesse. Acho que vocês deveriam comerçar sempre algo do zero (principaemente na construção da máquina), pois isso evitaria esses montes de erros.

Obrigado.
3 respostas

Oi, Paulo, espero que você esteja bem.

Entendo a frustração com esses erros, e agradeço pela sinceridade quanto ao conteúdo do curso.

O erro indica que o módulo distutils não está disponível no seu ambiente Python. Esse módulo é necessário para que o docker-compose funcione corretamente.

Para resolver isso, você pode instalar o pacote python3-distutils. No Ubuntu, você pode fazer isso com o seguinte comando:

sudo apt-get install python3-distutils

Depois de instalar o distutils, tente executar o docker-compose up novamente.

Além disso, se você estiver usando uma versão mais recente do Python (como o Python 3.12), pode ser necessário instalar o pacote python3.12-distutils especificamente para essa versão. Nesse caso, o comando seria:

sudo apt-get install python3.12-distutils

Novamente, agradeço pelo feedback. Esse retorno por vocês é importante.

Abraços!

Caso este post tenha lhe ajudado, por favor, marcar como solucionado ✓.

Estou passando pelo mesmo problema...

Sei que o Docker está rodando pois consigo executar o Hello World.

Informações extras:

Docker version 26.1.4, build 5650f9b docker-compose version 1.29.2, build unknown Python 3 12.3cle

Ao rodar o comando de instalação do distutils 1Ao rodar o comando de instalação do distutils 2

Ao executar o docker-compose up, recebo o seguinte erro, como se fosse uma incompatibilidade

devops@devops:~/CI$ docker-compose up

Traceback (most recent call last): File "/usr/lib/python3/dist-packages/docker/api/client.py", line 214, in _retrieve_server_version return self.version(api_version=False)["ApiVersion"] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/docker/api/daemon.py", line 181, in version return self._result(self._get(url), json=True) ^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/docker/utils/decorators.py", line 46, in inner return f(self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/docker/api/client.py", line 237, in _get return self.get(url, **self._set_request_timeout(kwargs)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/requests/sessions.py", line 602, in get return self.request("GET", url, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/requests/sessions.py", line 589, in request resp = self.send(prep, **send_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/requests/sessions.py", line 703, in send r = adapter.send(request, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/requests/adapters.py", line 486, in send resp = conn.urlopen( ^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 791, in urlopen response = self._make_request( ^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 497, in _make_request conn.request( TypeError: HTTPConnection.request() got an unexpected keyword argument 'chunked'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/bin/docker-compose", line 33, in sys.exit(load_entry_point('docker-compose==1.29.2', 'console_scripts', 'docker-compose')()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 81, in main command_func() File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 200, in perform_command project = project_from_options('.', options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/compose/cli/command.py", line 60, in project_from_options return get_project( ^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/compose/cli/command.py", line 152, in get_project client = get_client( ^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/compose/cli/docker_client.py", line 41, in get_client client = docker_client( ^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/compose/cli/docker_client.py", line 170, in docker_client client = APIClient(use_ssh_client=not use_paramiko_ssh, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/docker/api/client.py", line 197, in init self._version = self._retrieve_server_version() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/docker/api/client.py", line 221, in _retrieve_server_version raise DockerException( docker.errors.DockerException: Error while fetching server API version: HTTPConnection.request() got an unexpected keyword argument 'chunked'

Consegui resolver usando o sudo antes do docker-compose up