docker-compose keeps saying "ConnectionRefusedError: [Errno 111] Connection refused" - docker

Similar to other questions (see here and here) I'm getting the following error, both ways, with sudo or without:
/snap/docker/2343/lib/python3.6/site-packages/paramiko/transport.py:33: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography and will be removed in a future release.
from cryptography.hazmat.backends import default_backend
Traceback (most recent call last):
File "/snap/docker/2343/lib/python3.6/site-packages/urllib3/connectionpool.py", line 710, in urlopen
chunked=chunked,
File "/snap/docker/2343/lib/python3.6/site-packages/urllib3/connectionpool.py", line 398, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/snap/docker/2343/usr/lib/python3.6/http/client.py", line 1285, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/snap/docker/2343/usr/lib/python3.6/http/client.py", line 1331, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/snap/docker/2343/usr/lib/python3.6/http/client.py", line 1280, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/snap/docker/2343/usr/lib/python3.6/http/client.py", line 1046, in _send_output
self.send(msg)
File "/snap/docker/2343/usr/lib/python3.6/http/client.py", line 984, in send
self.connect()
File "/snap/docker/2343/lib/python3.6/site-packages/docker/transport/unixconn.py", line 30, in connect
sock.connect(self.unix_socket)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/snap/docker/2343/lib/python3.6/site-packages/requests/adapters.py", line 450, in send
timeout=timeout
File "/snap/docker/2343/lib/python3.6/site-packages/urllib3/connectionpool.py", line 788, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "/snap/docker/2343/lib/python3.6/site-packages/urllib3/util/retry.py", line 550, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/snap/docker/2343/lib/python3.6/site-packages/urllib3/packages/six.py", line 769, in reraise
raise value.with_traceback(tb)
File "/snap/docker/2343/lib/python3.6/site-packages/urllib3/connectionpool.py", line 710, in urlopen
chunked=chunked,
File "/snap/docker/2343/lib/python3.6/site-packages/urllib3/connectionpool.py", line 398, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/snap/docker/2343/usr/lib/python3.6/http/client.py", line 1285, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/snap/docker/2343/usr/lib/python3.6/http/client.py", line 1331, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/snap/docker/2343/usr/lib/python3.6/http/client.py", line 1280, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/snap/docker/2343/usr/lib/python3.6/http/client.py", line 1046, in _send_output
self.send(msg)
File "/snap/docker/2343/usr/lib/python3.6/http/client.py", line 984, in send
self.connect()
File "/snap/docker/2343/lib/python3.6/site-packages/docker/transport/unixconn.py", line 30, in connect
sock.connect(self.unix_socket)
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionRefusedError(111, 'Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/snap/docker/2343/lib/python3.6/site-packages/docker/api/client.py", line 214, in _retrieve_server_version
return self.version(api_version=False)["ApiVersion"]
File "/snap/docker/2343/lib/python3.6/site-packages/docker/api/daemon.py", line 181, in version
return self._result(self._get(url), json=True)
File "/snap/docker/2343/lib/python3.6/site-packages/docker/utils/decorators.py", line 46, in inner
return f(self, *args, **kwargs)
File "/snap/docker/2343/lib/python3.6/site-packages/docker/api/client.py", line 237, in _get
return self.get(url, **self._set_request_timeout(kwargs))
File "/snap/docker/2343/lib/python3.6/site-packages/requests/sessions.py", line 542, in get
return self.request('GET', url, **kwargs)
File "/snap/docker/2343/lib/python3.6/site-packages/requests/sessions.py", line 529, in request
resp = self.send(prep, **send_kwargs)
File "/snap/docker/2343/lib/python3.6/site-packages/requests/sessions.py", line 645, in send
r = adapter.send(request, **kwargs)
File "/snap/docker/2343/lib/python3.6/site-packages/requests/adapters.py", line 501, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionRefusedError(111, 'Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/snap/docker/2343/bin/docker-compose", line 33, in <module>
sys.exit(load_entry_point('docker-compose==1.29.2', 'console_scripts', 'docker-compose')())
File "/snap/docker/2343/lib/python3.6/site-packages/compose/cli/main.py", line 81, in main
command_func()
File "/snap/docker/2343/lib/python3.6/site-packages/compose/cli/main.py", line 200, in perform_command
project = project_from_options('.', options)
File "/snap/docker/2343/lib/python3.6/site-packages/compose/cli/command.py", line 70, in project_from_options
enabled_profiles=get_profiles_from_options(options, environment)
File "/snap/docker/2343/lib/python3.6/site-packages/compose/cli/command.py", line 153, in get_project
verbose=verbose, version=api_version, context=context, environment=environment
File "/snap/docker/2343/lib/python3.6/site-packages/compose/cli/docker_client.py", line 43, in get_client
environment=environment, tls_version=get_tls_version(environment)
File "/snap/docker/2343/lib/python3.6/site-packages/compose/cli/docker_client.py", line 170, in docker_client
client = APIClient(use_ssh_client=not use_paramiko_ssh, **kwargs)
File "/snap/docker/2343/lib/python3.6/site-packages/docker/api/client.py", line 197, in __init__
self._version = self._retrieve_server_version()
File "/snap/docker/2343/lib/python3.6/site-packages/docker/api/client.py", line 222, in _retrieve_server_version
f'Error while fetching server API version: {e}'
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', ConnectionRefusedError(111, 'Connection refused'))
Docker-Compose version is 1.29.2, build unknown.
Docker-Desktop v4.16.2 is running.
The docker-compose file is the sample from the installation guide:
services:
opensearch-node1: # This is also the hostname of the container within the Docker network (i.e. https://opensearch-node1/)
image: opensearchproject/opensearch:latest # Specifying the latest available image - modify if you want a specific version
container_name: opensearch-node1
environment:
- cluster.name=opensearch-cluster # Name the cluster
- node.name=opensearch-node1 # Name the node that will run in this container
- discovery.seed_hosts=opensearch-node1,opensearch-node2 # Nodes to look for when discovering the cluster
- cluster.initial_cluster_manager_nodes=opensearch-node1,opensearch-node2 # Nodes eligible to serve as cluster manager
- bootstrap.memory_lock=true # Disable JVM heap memory swapping
- "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m" # Set min and max JVM heap sizes to at least 50% of system RAM
ulimits:
memlock:
soft: -1 # Set memlock to unlimited (no soft or hard limit)
hard: -1
nofile:
soft: 65536 # Maximum number of open files for the opensearch user - set to at least 65536
hard: 65536
volumes:
- opensearch-data1:/usr/share/opensearch/data # Creates volume called opensearch-data1 and mounts it to the container
ports:
- 9200:9200 # REST API
- 9600:9600 # Performance Analyzer
networks:
- opensearch-net # All of the containers will join the same Docker bridge network
opensearch-node2:
image: opensearchproject/opensearch:latest # This should be the same image used for opensearch-node1 to avoid issues
container_name: opensearch-node2
environment:
- cluster.name=opensearch-cluster
- node.name=opensearch-node2
- discovery.seed_hosts=opensearch-node1,opensearch-node2
- cluster.initial_cluster_manager_nodes=opensearch-node1,opensearch-node2
- bootstrap.memory_lock=true
- "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
volumes:
- opensearch-data2:/usr/share/opensearch/data
networks:
- opensearch-net
opensearch-dashboards:
image: opensearchproject/opensearch-dashboards:latest # Make sure the version of opensearch-dashboards matches the version of opensearch installed on other nodes
container_name: opensearch-dashboards
ports:
- 5601:5601 # Map host port 5601 to container port 5601
expose:
- "5601" # Expose port 5601 for web access to OpenSearch Dashboards
environment:
OPENSEARCH_HOSTS: '["https://opensearch-node1:9200","https://opensearch-node2:9200"]' # Define the OpenSearch nodes that OpenSearch Dashboards will query
networks:
- opensearch-net
volumes:
opensearch-data1:
opensearch-data2:
networks:
opensearch-net:
Docker-Service (version 23.0.1, build a5ee5b1) is both, started and enabled.
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2023-02-15 16:21:30 CET; 3min 6s ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 115111 (dockerd)
Tasks: 13
Memory: 24.5M
CPU: 433ms
CGroup: /system.slice/docker.service
└─115111 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Feb 15 16:21:29 pb-hp dockerd[115111]: time="2023-02-15T16:21:29.718609786+01:00" level=info msg="[core] [Channel #4] Channel Connectivity change to READY" module=grpc
Feb 15 16:21:29 pb-hp dockerd[115111]: time="2023-02-15T16:21:29.805482945+01:00" level=info msg="[graphdriver] using prior storage driver: zfs"
Feb 15 16:21:29 pb-hp dockerd[115111]: time="2023-02-15T16:21:29.821299671+01:00" level=info msg="Loading containers: start."
Feb 15 16:21:29 pb-hp dockerd[115111]: time="2023-02-15T16:21:29.944847466+01:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a >
Feb 15 16:21:29 pb-hp dockerd[115111]: time="2023-02-15T16:21:29.979883193+01:00" level=info msg="Loading containers: done."
Feb 15 16:21:29 pb-hp dockerd[115111]: time="2023-02-15T16:21:29.991791851+01:00" level=info msg="Docker daemon" commit=bc3805a graphdriver=zfs version=23.0.1
Feb 15 16:21:29 pb-hp dockerd[115111]: time="2023-02-15T16:21:29.991880201+01:00" level=info msg="Daemon has completed initialization"
Feb 15 16:21:30 pb-hp dockerd[115111]: time="2023-02-15T16:21:30.013044715+01:00" level=info msg="[core] [Server #7] Server created" module=grpc
Feb 15 16:21:30 pb-hp systemd[1]: Started Docker Application Container Engine.
Feb 15 16:21:30 pb-hp dockerd[115111]: time="2023-02-15T16:21:30.023604797+01:00" level=info msg="API listen on /run/docker.sock"
I can see that a container that I imported in Docker-Desktop is running:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bd0f564c0243 docker101tutorial "/docker-entrypoint.…" 2 hours ago Up 2 hours 0.0.0.0:80->80/tcp docker-tutorial
According to answers to similar problems, I've tried the following already:
source ~/.bashrc (see here)
sudo groupadd docker plus sudo usermod -aG docker $USER (see here). groups is confirming that I am in the group docker.
sudo gpasswd -a $USER docker plus newgrp docker - doing the same as above, just to make sure everything has been tried (see here)
sudo chmod 666 /var/run/docker.sock (potentially unsafe, but it's only my development machine) (see here)
sudo service docker restart (sudo systemctl status docker.service in my case) (see here)
"Enable Docker Compose V1/V2 compatibility mode" is checked in Docker-Desktop (see here) though I guess this is unnecessary because of the initial line version: '3'.
I also wanted to set "WSL Integration" as recommended here but the option is not present in my version of Docker Desktop.
By the way, the same error appears when I say: $ docker-compose -f /home/bo/git/gokb/docker-compose-default.yml down.
How can I make the error disappear and compose?
I am a very-newbie to docker.

Related

Failed to establish a new connection Errno 111 Connection Refused?

I am trying to get the web, db and redis services running via docker compose but my web container keeps going down. And on inspecting the logs, i see :- urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='localhost', port=8443): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fc998b43070>: Failed to establish a new connection: [Errno 111] Connection refused'))
To Reproduce the issue :-
1. git clone https://github.com/PostHog/posthog && cd posthog and run docker-compose up -d
2. This is my docker compose file :-
services:
db:
container_name: posthog_db
environment:
POSTGRES_DB: posthog
POSTGRES_PASSWORD: posthog
POSTGRES_USER: posthog
image: postgres:alpine
volumes:
- postgres-data:/var/lib/postgresql/data
redis:
container_name: posthog_redis
image: redis:alpine
web:
container_name: posthog_web
depends_on:
- db
- redis
environment:
SKIP_SERVICE_VERSION_REQUIREMENTS: '1'
DISBALE_SECURE_SSL_REDIRECT: 'true'
SECURE_COOKIES: 'false'
DATABASE_URL: postgres://posthog:posthog#db:5432/posthog
REDIS_URL: redis://redis:6379/
SECRET_KEY: "eda6e05b653466fd47892f7b26a253eeda17e2df1d932c8022b6f0ab"
image: posthog/posthog:latest
links:
- db:db
- redis:redis
ports:
- 8000:8000
- 80:8000
volumes:
postgres-data:
version: '2'
On inspecting the logs, this is what i am seeing.
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 169, in _new_conn
conn = connection.create_connection(
File "/usr/local/lib/python3.8/site-packages/urllib3/util/connection.py", line 96, in create_connection
raise err
File "/usr/local/lib/python3.8/site-packages/urllib3/util/connection.py", line 86, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 382, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn
conn.connect()
File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 353, in connect
conn = self._new_conn()
File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 181, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f7e78794190>: Failed to establish a new connection: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
resp = conn.urlopen(
File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "/usr/local/lib/python3.8/site-packages/urllib3/util/retry.py", line 574, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='localhost', port=8443): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f7e78794190>: Failed to establish a new connection: [Errno 111] Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 21, in
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.8/site-packages/django/core/management/init.py", line 419, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.8/site-packages/django/core/management/init.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 398, in execute
output = self.handle(*args, **options)
File "/home/posthog/code/ee/management/commands/migrate_clickhouse.py", line 41, in handle
self.migrate(CLICKHOUSE_HTTP_URL, options)
File "/home/posthog/code/ee/management/commands/migrate_clickhouse.py", line 44, in migrate
database = Database(
File "/usr/local/lib/python3.8/site-packages/infi/clickhouse_orm/database.py", line 111, in init
self.db_exists = self._is_existing_database()
File "/usr/local/lib/python3.8/site-packages/infi/clickhouse_orm/database.py", line 418, in _is_existing_database
r = self._send("SELECT count() FROM system.databases WHERE name = '%s'" % self.db_name)
File "/usr/local/lib/python3.8/site-packages/infi/clickhouse_orm/database.py", line 369, in _send
r = self.request_session.post(self.db_url, params=params, data=data, stream=stream, timeout=self.timeout)
File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 590, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='localhost', port=8443): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f7e78794190>: Failed to establish a new connection: [Errno 111] Connection refused'))
Environment
Ubuntu 20.04.3 LTS && Ubuntu 16.04
Docker version 20.10.9, build c2ea9bc && Docker version 19.03.12, build 48a66213fe
docker-compose version 1.22.0, build f46880fe && docker-compose version 1.8.0, build unknown

Docker container going down

I have 3 containers who communicates and exchange data through each other by sending jobs via RabbitMQ.
Since yesterday, the last container to be executed in the workflow (encoder_aggregatore) exits as soon as it is built up:
$docker-compose up -d --build
[..]
$docker ps -a
0f521c4260a5 encoder_my-pre-encoder "python main.py" About an hour ago Up 20 minutes encoder_my-pre-encoder_1
72c3f5a2aa9c encoder_aggregatore "python /src/main.py" 18 hours ago Exited (1) 20 minutes ago encoder_aggregatore_1
dd9104e888ee encoder_classificatore "python /src/main.py" 20 hours ago Up 20 minutes 0.0.0.0:8080->5000/tcp encoder_classificatore_1
9
More info:
$docker inspect 72c3f5a2aa9c
The output is here.
I'm totally a newby in Docker. I do not know if it can help but I noticed that, if I edit the code of the "broken" container, the new code is compiled but executed on the "old" data job sent by container encoder_my-pre-encoder. I guess then that, for some reason, their communication broke.
Could you give me some hints on what it is going on?
EDIT 1:
docker-compose.yml:
version: '2.1'
services:
files:
image: busybox
volumes:
- ./file/input:/file/input
- ./file/output:/file/output
grafana:
image: grafana/grafana:5.1.0
ports:
- 3000:3000
volumes:
- ./prometheus/grafana/:/etc/grafana/provisioning/
environment:
- GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource
- GF_AUTH_BASIC_ENABLED=false
depends_on:
- prometheus
prometheus:
image: prom/prometheus
volumes:
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
ports:
- 9090:9090
aggregatore:
build: aggregatore/.
volumes:
- ./aggregatore:/src
volumes_from:
- files
ports:
- 8000:8000
command: ["python", "/src/main.py"]
depends_on:
rabbit:
condition: service_healthy
classificatore:
build: classificatore/.
volumes:
- ./classificatore:/src
volumes_from:
- files
ports:
- 8080:5000
command: ["python", "/src/main.py"]
depends_on:
rabbit:
condition: service_healthy
my-pre-encoder:
build: mpeg-pre-encoder/.
volumes:
- ./my-pre-encoder:/src
- ./gabac_encoder:/src/gabac_encoder
volumes_from:
- files
depends_on:
rabbit:
condition: service_healthy
rabbit:
image: rabbitmq
ports:
- 5672:5672
healthcheck:
test: ["CMD", "rabbitmqctl", "cluster_status"]
interval: 5s
timeout: 2s
retries: 20
aggregatore container log:
Traceback (most recent call last):
File "/src/main.py", line 94, in <module>
rabbit.wait_for_job(worker)
File "/src/util.py", line 75, in wait_for_job
self.channel.start_consuming()
File "/usr/local/lib/python3.7/site-packages/pika/adapters/blocking_connection.py", line 1822, in start_consuming
self.connection.process_data_events(time_limit=None)
File "/usr/local/lib/python3.7/site-packages/pika/adapters/blocking_connection.py", line 758, in process_data_events
self._dispatch_channel_events()
File "/usr/local/lib/python3.7/site-packages/pika/adapters/blocking_connection.py", line 521, in _dispatch_channel_events
impl_channel._get_cookie()._dispatch_events()
File "/usr/local/lib/python3.7/site-packages/pika/adapters/blocking_connection.py", line 1445, in _dispatch_events
evt.body)
File "/src/util.py", line 68, in callback
worker_function(eval(body))
File "<decorator-gen-1>", line 2, in worker
File "/usr/local/lib/python3.7/site-packages/prometheus_client/context_managers.py", line 66, in wrapped
return func(*args, **kwargs)
File "/src/main.py", line 62, in worker
updateMitb(out_file, au['mitb_ptr'], au['AU_start_position'], au['AU_end_position'], au['dscn_value_ptr'])
KeyError: 'mitb_ptr'
The container compiles the "new" code I wrote to handle new data added by previous containers (encoder_my-pre-encoder, encoder_classificatore).
Since the aggregatore container does not receive new job, it fails to process the new code in the old data job.
aggregatore Dockerfile:
FROM python:3
RUN mkdir /src
ADD requirements.txt /src/.
WORKDIR /src
RUN pip install -r requirements.txt
ADD . /src/.
CMD ["python", "main.py"]
The log
In aggregatore/
$python main.py
2019-10-03 14:06:19,988 Could not get addresses to use: [Errno -2] Name or service not known (rabbit)
2019-10-03 14:06:19,988 Could not connect, 0 attempts left
2019-10-03 14:06:19,989 Connection open failed - gaierror(-2, 'Name or service not known')
Traceback (most recent call last):
File "main.py", line 18, in <module>
rabbit = Rabbit()
File "/home/martina/PycharmProjects/mpegg_original/venv/lib/python3.6/site-packages/singleton_decorator/decorator.py", line 14, in __call__
self._instance = self.__wrapped__(*args, **kwargs)
File "/home/martina/PycharmProjects/mpegg_original/encoder/aggregatore/util.py", line 61, in __init__
self.connection = pika.BlockingConnection(pika.ConnectionParameters(host=RABBIT_HOST))
File "/home/martina/PycharmProjects/mpegg_original/venv/lib/python3.6/site-packages/pika/adapters/blocking_connection.py", line 377, in __init__
self._process_io_for_connection_setup()
File "/home/martina/PycharmProjects/mpegg_original/venv/lib/python3.6/site-packages/pika/adapters/blocking_connection.py", line 417, in _process_io_for_connection_setup
self._open_error_result.is_ready)
File "/home/martina/PycharmProjects/mpegg_original/venv/lib/python3.6/site-packages/pika/adapters/blocking_connection.py", line 469, in _flush_output
raise maybe_exception
File "/home/martina/PycharmProjects/mpegg_original/venv/lib/python3.6/site-packages/pika/adapters/base_connection.py", line 176, in _adapter_connect
socket.IPPROTO_TCP)
File "/home/martina/PycharmProjects/mpegg_original/venv/lib/python3.6/site-packages/pika/adapters/base_connection.py", line 304, in _getaddrinfo
return socket.getaddrinfo(host, port, family, socktype, proto)
File "/usr/lib/python3.6/socket.py", line 745, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known
bash into the container:
$docker exec -it encoder_aggregatore_1 bash
Error response from daemon: Container 72c3f5a2aa9caba040bc60d1608c193e250967cde1a2b68a74d47cf36be887ee is not running
$docker run -it encoder_aggregatore /bin/bash
root#d5d030d88f76:/src# python main.py
2019-10-03 13:30:30,864 Connection to 31.199.53.9:5672 failed: timeout
2019-10-03 13:30:30,864 Could not connect, 0 attempts left
2019-10-03 13:30:30,865 Connection open failed - 'Connection to 31.199.53.9:5672 failed: timeout'
Traceback (most recent call last):
File "main.py", line 18, in <module>
rabbit = Rabbit()
File "/usr/local/lib/python3.7/site-packages/singleton_decorator/decorator.py", line 14, in __call__
self._instance = self.__wrapped__(*args, **kwargs)
File "/src/util.py", line 61, in __init__
self.connection = pika.BlockingConnection(pika.ConnectionParameters(host=RABBIT_HOST))
File "/usr/local/lib/python3.7/site-packages/pika/adapters/blocking_connection.py", line 377, in __init__
self._process_io_for_connection_setup()
File "/usr/local/lib/python3.7/site-packages/pika/adapters/blocking_connection.py", line 417, in _process_io_for_connection_setup
self._open_error_result.is_ready)
File "/usr/local/lib/python3.7/site-packages/pika/adapters/blocking_connection.py", line 471, in _flush_output
raise exceptions.ConnectionClosed(maybe_exception)
pika.exceptions.ConnectionClosed: Connection to 31.199.53.9:5672 failed: timeout

Error with docker-compose file for vernemq and nginx

I wrote a docker-compose file to run two services vernemq and nginx. When i run the command docker-compose up on my terminal, i keep on getting the error below.
If this might help, i am using a virtual machine with the ubuntu 18.04 image
I tried leaving the IP address away in the vernemq service but it didn't help.
Here is my docker compose file
version: "3.7"
services:
vernemq:
image: erlio/docker-vernemq:1.8.0
hostname: vernemq
container_name: vernemq
expose:
- "1883"
- "9001"
ports:
- "IPaddress:1883:1883"
- "IPaddress:9001:9001"
volumes:
- ./configvol:/etc/vernemq
- ./datavol:/var/lib/vernemq
- ./logvol:/var/log/vernemq
network_mode: "host"
nginx:
image: nginx:1.16.0
hostname: nginx
container_name: robotWebView
expose:
- "80"
ports:
- "80:80"
volumes:
- ./nginxvol:/usr/share/nginx/html
network_mode: "host"
and this is the error i get
# docker-compose up
Pulling vernemq (erlio/docker-vernemq:1.8.0)...
Traceback (most recent call last):
File "site-packages/dockerpycreds/store.py", line 80, in _execute
File "subprocess.py", line 356, in check_output
File "subprocess.py", line 438, in run
subprocess.CalledProcessError: Command '['/usr/bin/docker-credential-secretservice', 'get']' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "site-packages/docker/auth.py", line 264, in _resolve_authconfig_credstore
File "site-packages/dockerpycreds/store.py", line 35, in get
File "site-packages/dockerpycreds/store.py", line 93, in _execute
dockerpycreds.errors.StoreError: Credentials store docker-credential-secretservice exited with "Error calling StartServiceByName for org.freedesktop.secrets: Timeout was reached".
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "bin/docker-compose", line 6, in <module>
File "compose/cli/main.py", line 71, in main
File "compose/cli/main.py", line 127, in perform_command
File "compose/cli/main.py", line 1085, in up
File "compose/cli/main.py", line 1081, in up
File "compose/project.py", line 527, in up
File "compose/service.py", line 354, in ensure_image_exists
File "compose/service.py", line 1222, in pull
File "compose/progress_stream.py", line 102, in get_digest_from_pull
File "compose/service.py", line 1187, in _do_pull
File "site-packages/docker/api/image.py", line 381, in pull
File "site-packages/docker/auth.py", line 48, in get_config_header
File "site-packages/docker/auth.py", line 322, in resolve_authconfig
File "site-packages/docker/auth.py", line 235, in resolve_authconfig
File "site-packages/docker/auth.py", line 281, in _resolve_authconfig_credstore
docker.errors.DockerException: Credentials store error: StoreError('Credentials store docker-credential-secretservice exited with "Error calling StartServiceByName for org.freedesktop.secrets: Timeout was reached".',)
[10433] Failed to execute script docker-compose

Docker Compose request (HTTP) read timeout

When I run this:
docker-compose --verbose create
I get this error:
compose.config.config.find: Using configuration files: ./docker-compose.yml
docker.auth.find_config_file: Trying paths: ['/home/ubuntu/.docker/config.json', '/home/ubuntu/.dockercfg']
docker.auth.find_config_file: No config file found
Traceback (most recent call last):
File "/usr/local/bin/docker-compose", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 68, in main
command()
File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 115, in perform_command
project = project_from_options('.', options)
File "/usr/local/lib/python2.7/dist-packages/compose/cli/command.py", line 37, in project_from_options
override_dir=options.get('--project-directory'),
File "/usr/local/lib/python2.7/dist-packages/compose/cli/command.py", line 99, in get_project
host=host, environment=environment
File "/usr/local/lib/python2.7/dist-packages/compose/cli/command.py", line 74, in get_client
version_info = six.iteritems(client.version())
File "/usr/local/lib/python2.7/dist-packages/docker/api/daemon.py", line 177, in version
return self._result(self._get(url), json=True)
File "/usr/local/lib/python2.7/dist-packages/docker/utils/decorators.py", line 46, in inner
return f(self, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/docker/api/client.py", line 189, in _get
return self.get(url, **self._set_request_timeout(kwargs))
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 488, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 475, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 596, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 499, in send
raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=120)
I tried to extend the time:
export DOCKER_CLIENT_TIMEOUT=120
export COMPOSE_HTTP_TIMEOUT=120
But clearly it has had no affect.
I rather not share my compose file. But here is a part of it:
version: '2'
services:
ntpd:
build: ../../../www/DockerNtpd/alpine
volumes:
- ntpd-log:/var/log/ntpd/:rw
network_mode: host
consul:
image: consul
networks:
dbs:
aliases:
- consul
apps:
aliases:
- consul
volumes:
- consul-log:/var/log/consul/:rw
- consul-conf:/etc/consul/:rw
vault:
build: ../../../www/DockerVault/alpine
depends_on:
- consul
volumes:
- vault-log:/var/log/vault/:rw
networks:
dbs:
aliases:
- vault
apps:
aliases:
- vault
It seems that it is getting stuck on the Consul image: https://hub.docker.com/_/consul/
I also checked the https://status.docker.com/ and it says All Systems Operational.
It used to work when I used the Vagrant provisioning for Docker.
More details:
root 1304 0.0 0.8 110032 8392 ? Ssl 18:44 0:00 /usr/bin/docker-volume-local-persist
root 3172 0.0 3.9 311140 39004 pts/0 Tl 20:34 0:00 dockerd
root 3179 0.0 0.9 137428 9408 ? Ssl 20:34 0:00 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --shim docker-containerd-shim --runtime docker-runc
lsb_release -a
LSB Version: core-9.20160110ubuntu5-amd64:core-9.20160110ubuntu5-noarch:security-9.20160110ubuntu5-amd64:security-9.20160110ubuntu5-noarch
Distributor ID: Ubuntu
Description: Ubuntu 17.04
Release: 17.04
Codename: zesty

Docker Compose Error "TypeError: expected string or buffer" on docker:dind (ports)

I'm triying to setup my containers with docker-compose in a docker container (docker:dind) to make the tests at gitlab ci.
From yesterday to today it has begin to fail on "docker-compose up" and i reduced the error to "ports" segment at service in docker-compose.yml. The simpliest configuration that fails is that:
version: '3':
services:
ubuntu:
image: ubuntu:latest
ports:
- 80:80
I've tried without ports and it works.
The specific error is this:
ERROR: for ubuntu expected string or buffer
Traceback (most recent call last):
File "/usr/bin/docker-compose", line 11, in <module>
sys.exit(main())
File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 68, in main
command()
File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 118, in perform_command
handler(command, command_options)
File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 926, in up
scale_override=parse_scale_args(options['--scale']),
File "/usr/lib/python2.7/site-packages/compose/project.py", line 424, in up
get_deps
File "/usr/lib/python2.7/site-packages/compose/parallel.py", line 69, in parallel_execute
raise error_to_reraise
TypeError: expected string or buffer
This is the steps to reproduce it:
(at your machine)
~ docker run --privileged -d docker:stable-dind
~ docker exec -ti *CONTAINER_ID* sh
(inside of the docker container)
~ apk add --no-cache py-pip vim
~ pip install docker-compose
(here edit a docker-compose.yml and paste the up yaml code)
~ docker-compose up
I don't know if is a problem with python, with docker, docker-compose....
Anybody can help me?
Thanks!
Error? the problem is most probably(not given) coming from your "docker-compose.yml" file, docker expected a string or bytes-like object but one or more of the values supplied doesn't conform to that format.
Solution - make sure the values supplied to your docker-compose.yml properties document are in the right format.
For example one time , i had the wrong spacing in the following property:
i.e it looked like;
ports:
- 8000: 8000
but should have been
ports:
- 8000:8000
Notice the spacing of the values supplied.
I encountered a similar error when working with a NestJS application on macOS.
When I run the command docker-compose up I get the error:
Traceback (most recent call last):
File "docker-compose", line 3, in <module>
File "compose/cli/main.py", line 81, in main
File "compose/cli/main.py", line 200, in perform_command
File "compose/cli/command.py", line 60, in project_from_options
File "compose/cli/command.py", line 148, in get_project
File "compose/config/config.py", line 423, in load
File "compose/config/config.py", line 424, in <listcomp>
File "compose/config/config.py", line 626, in process_config_file
File "compose/config/validation.py", line 474, in validate_against_config_schema
File "compose/config/validation.py", line 537, in handle_errors
File "jsonschema/validators.py", line 328, in iter_errors
File "jsonschema/_validators.py", line 282, in properties
File "jsonschema/validators.py", line 344, in descend
File "jsonschema/validators.py", line 328, in iter_errors
File "jsonschema/_validators.py", line 23, in patternProperties
File "jsonschema/validators.py", line 344, in descend
File "jsonschema/validators.py", line 328, in iter_errors
File "jsonschema/_validators.py", line 263, in ref
File "jsonschema/validators.py", line 344, in descend
File "jsonschema/validators.py", line 328, in iter_errors
File "jsonschema/_validators.py", line 282, in properties
File "jsonschema/validators.py", line 344, in descend
File "jsonschema/validators.py", line 328, in iter_errors
File "jsonschema/_legacy_validators.py", line 55, in items_draft3_draft4
File "jsonschema/validators.py", line 344, in descend
File "jsonschema/validators.py", line 328, in iter_errors
File "jsonschema/_validators.py", line 337, in oneOf
File "jsonschema/validators.py", line 344, in descend
File "jsonschema/validators.py", line 328, in iter_errors
File "jsonschema/_validators.py", line 45, in additionalProperties
File "jsonschema/_utils.py", line 98, in find_additional_properties
File "/Users/administrator/jenkins/workspace/dsg_compose_1.29.2/build/toolchain/Frameworks/Python.framework/Versions/3.9/lib/python3.9/re.py", line 201, in search
TypeError: expected string or bytes-like object
[21470] Failed to execute script docker-compose
Here's how I solved it
I checked the docker-compose.yml file and I realized that it did not have the container port specified. This was how the file looked:
version: "3"
services:
web:
image: my-app
build: .
container_name: my-app
ports:
- 8080:
env_file: .env
volumes:
- ".:/app"
All I had to do was to add the container port which was 3001:
version: "3"
services:
web:
image: my-app
build: .
container_name: my-app
ports:
- 8080:3001
env_file: .env
volumes:
- ".:/app"

Resources