Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker-compose unable to restart its container if the master docker has been restarted #1610

Closed
icy opened this issue Jun 29, 2015 · 4 comments
Labels

Comments

@icy
Copy link

icy commented Jun 29, 2015

How to reproduce

Sample error logs

From docker-compose when docker daemon has been restarted

wp_1 | 2015-06-29 0Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/lib/python2.7/dist-packages/compose/cli/multiplexer.py", line 41, in _enqueue_output
    for item in generator:
  File "/usr/local/lib/python2.7/dist-packages/compose/cli/log_printer.py", line 62, in _make_log_generator
    exit_code = container.wait()
  File "/usr/local/lib/python2.7/dist-packages/compose/container.py", line 155, in wait
    return self.client.wait(self.id)
  File "/usr/local/lib/python2.7/dist-packages/docker/utils/decorators.py", line 15, in wrapped
    return f(self, resource_id, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/docker/client.py", line 1136, in wait
    res = self._post(url, timeout=timeout)
  File "/usr/local/lib/python2.7/dist-packages/docker/client.py", line 103, in _post
    return self.post(url, **self._set_request_timeout(kwargs))
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 508, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 465, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 573, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 415, in send
    raise ConnectionError(err, request=request)
ConnectionError: ('Connection aborted.', error(2, 'No such file or directory
@icy icy changed the title Docker-compose unable to restart its container of the master docker has been restarted Docker-compose unable to restart its container if the master docker has been restarted Jun 29, 2015
@aanand
Copy link

aanand commented Jul 1, 2015

docker-compose up (without -d) currently exits as soon as a single container exits. I think that's wrong - we should exit only when all containers have exited. However, perhaps we could add a flag to make it never exit unless killed - if all containers exit, it'll just wait for them to start again, or for more containers to be fired up.

This would require up to be smarter about keeping up with the state of the app, but I think that's a good thing - currently, if a container exits and immediately restarts, it just disappears from the log output. We should probably fetch the list of containers every few seconds and attach to any new ones. This would also make it resilient to the Docker daemon being restarted.

@icy
Copy link
Author

icy commented Jul 19, 2015

@aanand When the up command attaches to user tty, if the docker daemon is restarted, docker-compose is unable to connect to Docker Api. This makes all containers exit. However, docker-compose doesn't have any re-connect feature, it keeps running without yielding any useful information.

icy added a commit to icyfork/compose that referenced this issue Jul 19, 2015
…ive issue

When #docker-compose #up command is used, it may attach to user #tty to print logs.
During an #up session, if #docker daemon is restarted (any reason), #docker-compose
is unable to reconnect to #docker Api (#docker-compose should has a #reconnect feature).
it will print ConnectionError exception to #stdout, and keeps running without any
useful information, while all project containers actually exit.

This fix is useful when you use #supervisor to launch "#docker-compose up".
icy added a commit to icyfork/compose that referenced this issue Jul 19, 2015
…ive issue

When #docker-compose #up command is used, it may attach to user #tty to print logs.
During an #up session, if #docker daemon is restarted (any reason), #docker-compose
is unable to reconnect to #docker Api (#docker-compose should has a #reconnect feature).
it will print ConnectionError exception to #stdout, and keeps running without any
useful information, while all project containers actually exit.

This fix is useful when you use #supervisor to launch "#docker-compose up".
icy added a commit to icyfork/compose that referenced this issue Jul 19, 2015
…ive issue

When #docker-compose #up command is used, it may attach to user #tty to print logs.
During an #up session, if #docker daemon is restarted (any reason), #docker-compose
is unable to reconnect to #docker Api (#docker-compose should has a #reconnect feature).
it will print ConnectionError exception to #stdout, and keeps running without any
useful information, while all project containers actually exit.

This fix is useful when you use #supervisor to launch "#docker-compose up".

Signed-off-by: Ky-Anh Huynh <[email protected]>
icy added a commit to icyfork/compose that referenced this issue Jul 19, 2015
…ive issue

When #docker-compose #up command is used, it may attach to user #tty to print logs.
During an #up session, if #docker daemon is restarted (any reason), #docker-compose
is unable to reconnect to #docker Api (#docker-compose should has a #reconnect feature).
it will print ConnectionError exception to #stdout, and keeps running without any
useful information, while all project containers actually exit.

This fix is useful when you use #supervisor to launch "#docker-compose up".
icy added a commit to icyfork/compose that referenced this issue Jul 19, 2015
…ive issue

When #docker-compose #up command is used, it may attach to user #tty to print logs.
During an #up session, if #docker daemon is restarted (any reason), #docker-compose
is unable to reconnect to #docker Api (#docker-compose should has a #reconnect feature).
it will print ConnectionError exception to #stdout, and keeps running without any
useful information, while all project containers actually exit.

This fix is useful when you use #supervisor to launch "#docker-compose up".

Signed-off-by: Ky-Anh Huynh <[email protected]>
icy added a commit to icyfork/compose that referenced this issue Jul 19, 2015
…ive issue

When #docker-compose #up command is used, it may attach to user #tty to print logs.
During an #up session, if #docker daemon is restarted (any reason), #docker-compose
is unable to reconnect to #docker Api (#docker-compose should has a #reconnect feature).
it will print ConnectionError exception to #stdout, and keeps running without any
useful information, while all project containers actually exit.

This fix is useful when you use #supervisor to launch "#docker-compose up".

Signed-off-by: Ky-Anh Huynh <[email protected]>
@dnephin dnephin added the area/up label Feb 3, 2016
@stale
Copy link

stale bot commented Oct 10, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Oct 10, 2019
@icy
Copy link
Author

icy commented Oct 10, 2019

The issue is probably fixed in the latest version of docker-compose.

@icy icy closed this as completed Oct 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants