Connecting to Redis running in Docker Container from Host machine

后端 未结 5 1672
别跟我提以往
别跟我提以往 2021-02-01 14:20

I see lots of people struggling with this, sort of feel like maybe there is a bug in the redis container image, and others seem to be chasing a similar problem.

I\'m usi

5条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-01 15:00

    This is simpler way to set up a Redis container.

    Download image and run container

    docker run -d --name some-redis -p 6379:6379 redis
    

    If you don't have the image, this command will pull it. And then, if you need to access from redis-cli to console, can use:

    docker exec -it some-redis bash
    

    For enter to container console, and kind in the console:

    root@72c388dc2cb8:/data# redis-cli
    

    Output:

    127.0.0.1:6379> 
    

    This was enough for my use case (easy and fast local development).

提交回复
热议问题