Code
https://github.com/thiskevinwang/rust-redis-docker/tree/for-stackoverflow
Context:
- Written in Rust
Cargo.toml
:[dependencies] redis = "0.16.0" hyper = "0.13"
Local development ✅
Things that work:
- running a redis docker container
bitnami/redis
, published with-p 6379:6379
redis-cli
can connect to this docker container successfully- browser can hit the rust code at
localhost:3000
GET /
displays some text ✅GET /redis
increments a counter in redis, and displays it ✅
Running rust-code in docker ❌
The rust docker container fails to connect to the redis docker container
- running the same redis docker container
bitnami/redis
, - browser can hit the rust-container at
localhost:3000
GET /
displays some text, as before ✅GET /redis
causes rust code to panic ❌Connection refused (os error 111)
I'm not sure if this is a problem with me incorrectly handling "docker networking" or if I'm using the redis crate incorrectly (although documentation is pretty sparse).