I'm new to Docker and playing around with Dockerfiles and .yml scripts. I tried to replicate the example on the get started page for compose and when I type either docker-compose up
or docker-compose build
I get the same error message as follows:
Traceback (most recent call last):
File "docker-compose", line 6, in <module>
File "compose/cli/main.py", line 71, in main
File "compose/cli/main.py", line 124, in perform_command
File "compose/cli/command.py", line 41, in project_from_options
File "compose/cli/command.py", line 126, in get_project
File "compose/project.py", line 100, in from_config
File "compose/network.py", line 320, in get_networks
File "compose/network.py", line 125, in true_name
File "compose/network.py", line 146, in _set_legacy_flag
File "compose/network.py", line 106, in inspect
File "site-packages/docker/utils/decorators.py", line 19, in wrapped
File "site-packages/docker/api/network.py", line 211, in inspect_network
File "site-packages/docker/utils/decorators.py", line 46, in inner
File "site-packages/docker/api/client.py", line 198, in _get
File "site-packages/requests/sessions.py", line 521, in get
File "site-packages/requests/sessions.py", line 499, in request
File "site-packages/requests/sessions.py", line 672, in merge_environment_settings
File "site-packages/requests/utils.py", line 692, in get_environ_proxies
File "site-packages/requests/utils.py", line 676, in should_bypass_proxies
File "urllib/request.py", line 2612, in proxy_bypass
File "urllib/request.py", line 2589, in proxy_bypass_macosx_sysconf
File "urllib/request.py", line 2575, in _proxy_bypass_macosx_sysconf
ValueError: negative shift count
[24498] Failed to execute script docker-compose
Output of docker-compose version
1.22.0, build f46880f
Output of docker version
18.06.1-ce, build e68fc7a
Output of docker-compose config
(Make sure to add the relevant -f
and other flags)
services:
redis:
image: redis:alpine
web:
build:
context: /Users/guest/DockerData/composetest
ports:
- 5000:5000/tcp
version: '3.0'
Basically the steps explained the get started docs
1.
mkdir composetest
cd composetest
app.py
import time
import redis
from flask import Flask
app = Flask(__name__)
cache = redis.Redis(host='redis', port=6379)
def get_hit_count():
retries = 5
while True:
try:
return cache.incr('hits')
except redis.exceptions.ConnectionError as exc:
if retries == 0:
raise exc
retries -= 1
time.sleep(0.5)
@app.route('/')
def hello():
count = get_hit_count()
return 'Hello World! I have been seen {} times.\n'.format(count)
if __name__ == "__main__":
app.run(host="0.0.0.0", debug=True)
requirements.txt
flask
redis
Dockerfile
FROM python:3.4-alpine
ADD . /code
WORKDIR /code
RUN pip install -r requirements.txt
CMD ["python", "app.py"]
docker-compose.yml
version: '3'
services:
web:
build: .
ports:
- "5000:5000"
redis:
image: "redis:alpine"
The traceback error output shown above
built image
Traceback (most recent call last):
File "docker-compose", line 6, in <module>
File "compose/cli/main.py", line 71, in main
File "compose/cli/main.py", line 124, in perform_command
File "compose/cli/command.py", line 41, in project_from_options
File "compose/cli/command.py", line 126, in get_project
File "compose/project.py", line 100, in from_config
File "compose/network.py", line 320, in get_networks
File "compose/network.py", line 125, in true_name
File "compose/network.py", line 146, in _set_legacy_flag
File "compose/network.py", line 106, in inspect
File "site-packages/docker/utils/decorators.py", line 19, in wrapped
File "site-packages/docker/api/network.py", line 211, in inspect_network
File "site-packages/docker/utils/decorators.py", line 46, in inner
File "site-packages/docker/api/client.py", line 198, in _get
File "site-packages/requests/sessions.py", line 521, in get
File "site-packages/requests/sessions.py", line 499, in request
File "site-packages/requests/sessions.py", line 672, in merge_environment_settings
File "site-packages/requests/utils.py", line 692, in get_environ_proxies
File "site-packages/requests/utils.py", line 676, in should_bypass_proxies
File "urllib/request.py", line 2612, in proxy_bypass
File "urllib/request.py", line 2589, in proxy_bypass_macosx_sysconf
File "urllib/request.py", line 2575, in _proxy_bypass_macosx_sysconf
ValueError: negative shift count
[24498] Failed to execute script docker-compose
Since I'm new to Docker, I'm not too sure where to look for a more extended log for this.
Any help will be greatly appreciated!
OS version / distribution, docker-compose
install method, etc.
Mac OS: 10.14
Looks like a bug in the requests Python library. Can you share the full output of the docker-compose version
command? Does disabling your proxy get rid of the issue?
This report indicates this is in fact a bug in Python.
As a workaround, you may want to try tweaking your proxy configuration.
Closing since this appears to be (/have been) a Python issue.
what should be done to resolve this??
How to resolve this??
Go to your Network settings > click on the Advanced button > click on the Proxies tab.
Remove any addresses in the Bypass proxy settings for these hosts & Domains. Click Ok/Apply
try your command again.
Adding this here as I experienced a similar issue that had a very different reason.
Context: I executed a docker-compose command from the new Windows Terminal that then needed to fetch a docker image from an authenticated registry. As I was not logged in, docker-compose wanted to write that error about my expired Auth token to console and instead showed this:
Traceback (most recent call last):
File "logging\__init__.py", line 879, in emit
File "site-packages\colorama\ansitowin32.py", line 41, in write
File "site-packages\colorama\ansitowin32.py", line 162, in write
File "site-packages\colorama\ansitowin32.py", line 190, in write_and_convert
File "site-packages\colorama\ansitowin32.py", line 195, in write_plain_text
LookupError: unknown encoding: cp65001
Logged from file service.py, line 1240
Traceback (most recent call last):
File "logging\__init__.py", line 879, in emit
File "site-packages\colorama\ansitowin32.py", line 41, in write
File "site-packages\colorama\ansitowin32.py", line 162, in write
File "site-packages\colorama\ansitowin32.py", line 187, in write_and_convert
File "site-packages\colorama\ansitowin32.py", line 195, in write_plain_text
LookupError: unknown encoding: cp65001
Logged from file main.py, line 1082
Traceback (most recent call last):
File "docker-compose", line 6, in <module>
File "compose\cli\main.py", line 72, in main
File "compose\cli\main.py", line 128, in perform_command
File "compose\cli\main.py", line 1084, in up
File "compose\cli\utils.py", line 36, in yesno
File "compose\cli\utils.py", line 53, in input
File "site-packages\colorama\ansitowin32.py", line 41, in write
File "site-packages\colorama\ansitowin32.py", line 162, in write
File "site-packages\colorama\ansitowin32.py", line 190, in write_and_convert
File "site-packages\colorama\ansitowin32.py", line 195, in write_plain_text
LookupError: unknown encoding: cp65001
[15608] Failed to execute script docker-compose
After logging in to the registry (aws ecr in my case) things worked as expected
Go to your Network settings > click on the Advanced button > click on the Proxies tab.
Remove any addresses in the Bypass proxy settings for these hosts & Domains. Click Ok/Apply
try your command again.
No idea why this worked, but it did.
Most helpful comment
what should be done to resolve this??