0x1337
0x1337

Reputation: 1104

Unnable to connect to Redis from inside Docker container

When I start Docker container I get

OSError: Multiple exceptions: [Errno 111] Connect call failed ('::1', 6379), [Errno 111] Connect call failed ('127.0.0.1', 6379)

from Python, but this code works fine on the host machine. How to fix this?

Dockerfile: gist, OS: macOS 10.12

Upvotes: 0

Views: 543

Answers (1)

gesellix
gesellix

Reputation: 3124

You can only have a single CMD statement. To start both redis-server and python inside a single container you'll need to define a script or run a tool like supervisord to manage your processes. https://docs.docker.com/engine/admin/multi-service_container/ explains some options and also gives examples. In your case I would give the approach with a shell script a try. The Phusion base image https://github.com/phusion/baseimage-docker is a more advanced alternative, starting each process via init service, but might be overkill for your use case.

Upvotes: 2

Related Questions