如何使我的dockerized Go程序在默认端口上使用dockerized Redis?

I have a Go program that uses a Redis client on it's default port 6379. I started a container from the official Redis image and I can see that it's working because redis-cli recognizes it, but the Go container cannot connect to it.

I also tried linking (after starting the Redis container) with

docker run --link redis:redis [APP_CONTAINER_NAME]

And I get the same result. The Go Redis client from my program is not able to see the Redis server.

I the latest versions of docker, the linked container is available via DNS. Since you are using the default redis port you should be able to connect to redis using: redis://redis:6379