Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
132 views
in Technique[技术] by (71.8m points)

Not able to connect to the redis instance created with docker

I have created a docker container for redis but I am not able to connect the same instance with a redis client.

docker command i used to bring up my redis isntance docker run --name localredis -p 6379:6379 -d redis

please find below my docker inspect of the container

[
    {
        "Id": "ea6adada84602054f1057dded66c474231fcfdabcb3b0797fd82da0ff558cd6c",
        "Created": "2021-01-26T16:07:13.477202002Z",
        "Path": "docker-entrypoint.sh",
        "Args": [
            "redis-server"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 2675,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2021-01-26T16:07:13.834485936Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
        },
        "Image": "sha256:621ceef7494adfcbe0e523593639f6625795cc0dc91a750629367a8c7b3ccebb",
        "ResolvConfPath": "/var/lib/docker/containers/ea6adada84602054f1057dded66c474231fcfdabcb3b0797fd82da0ff558cd6c/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/ea6adada84602054f1057dded66c474231fcfdabcb3b0797fd82da0ff558cd6c/hostname",
        "HostsPath": "/var/lib/docker/containers/ea6adada84602054f1057dded66c474231fcfdabcb3b0797fd82da0ff558cd6c/hosts",
        "LogPath": "/var/lib/docker/containers/ea6adada84602054f1057dded66c474231fcfdabcb3b0797fd82da0ff558cd6c/ea6adada84602054f1057dded66c474231fcfdabcb3b0797fd82da0ff558cd6c-json.log",
        "Name": "/localredis",
        "RestartCount": 0,
        "Driver": "overlay2",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": [
            "66947da6a117e75cbbe696fad9e4cebd623d0209c94b63bdfb22d25ca723c074"
        ],
        "HostConfig": {
            "Binds": null,
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "default",
            "PortBindings": {
                "6379/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "6379"
                    }
                ]
            },
            "RestartPolicy": {
                "Name": "no",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "CapAdd": null,
            "CapDrop": null,
            "Capabilities": null,
            "Dns": [],
            "DnsOptions": [],
            "DnsSearch": [],
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "private",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 67108864,
            "Runtime": "runc",
            "ConsoleSize": [
                0,
                0
            ],
            "Isolation": "",
            "CpuShares": 0,
            "Memory": 0,
            "NanoCpus": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": [],
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": [],
            "DeviceCgroupRules": null,
            "DeviceRequests": null,
            "KernelMemory": 0,
            "KernelMemoryTCP": 0,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": null,
            "OomKillDisable": false,
            "PidsLimit": null,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0,
            "MaskedPaths": [
                "/proc/asound",
                "/proc/acpi",
                "/proc/kcore",
                "/proc/keys",
                "/proc/latency_stats",
                "/proc/timer_list",
                "/proc/timer_stats",
                "/proc/sched_debug",
                "/proc/scsi",
                "/sys/firmware"
            ],
            "ReadonlyPaths": [
                "/proc/bus",
                "/proc/fs",
                "/proc/irq",
                "/proc/sys",
                "/proc/sysrq-trigger"
            ]
        },
        "GraphDriver": {
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/f89d87a8018ce297dc6b204fff66b5da39212bc8a063be3e14fbb43813a377ad-init/diff:/var/lib/docker/overlay2/74014cbeac95ded3e80f5ec0ba64aafc252846b7c7517d5f1e00ca0ae8436e0e/diff:/var/lib/docker/overlay2/7f220239171723472e6e62802bb1f6a3341e1f3003414bb6f5f35ac8fef326a7/diff:/var/lib/docker/overlay2/5ebf1767ac29a0f344fc2134218365426f354e90e60e4ab51f09f9d571ac073f/diff:/var/lib/docker/overlay2/39eb79b70bd7680a7153eea515f4478d24733a67687a853643f87ff718566259/diff:/var/lib/docker/overlay2/6f9e7e2d91dcd0fa1f8d0ca68b600230b724c8add6bfa4102f8da12e667a5a31/diff:/var/lib/docker/overlay2/b8782f485b043e4168304f049982cb78c1039b09dae95eaed596ce61eb9ffd12/diff",
                "MergedDir": "/var/lib/docker/overlay2/f89d87a8018ce297dc6b204fff66b5da39212bc8a063be3e14fbb43813a377ad/merged",
                "UpperDir": "/var/lib/docker/overlay2/f89d87a8018ce297dc6b204fff66b5da39212bc8a063be3e14fbb43813a377ad/diff",
                "WorkDir": "/var/lib/docker/overlay2/f89d87a8018ce297dc6b204fff66b5da39212bc8a063be3e14fbb43813a377ad/work"
            },
            "Name": "overlay2"
        },
        "Mounts": [
            {
                "Type": "volume",
                "Name": "1bb68817383777a30df146c139e4e8d97ef7ceb3d72e2eeaba5e45bed472df05",
                "Source": "/var/lib/docker/volumes/1bb68817383777a30df146c139e4e8d97ef7ceb3d72e2eeaba5e45bed472df05/_data",
                "Destination": "/data",
                "Driver": "local",
                "Mode": "",
                "RW": true,
                "Propagation": ""
            }
        ],
        "Config": {
            "Hostname": "ea6adada8460",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "6379/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "GOSU_VERSION=1.12",
                "REDIS_VERSION=6.0.10",
                "REDIS_DOWNLOAD_URL=http://download.redis.io/releases/redis-6.0.10.tar.gz",
                "REDIS_DOWNLOAD_SHA=79bbb894f9dceb33ca699ee3ca4a4e1228be7fb5547aeb2f99d921e86c1285bd"
            ],
            "Cmd": [
                "redis-server"
            ],
            "Image": "redis",
            "Volumes": {
                "/data": {}
            },
            "WorkingDir": "/data",
            "Entrypoint": [
                "docker-entrypoint.sh"
            ],
            "OnBuild": null,
            "Labels": {}
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "62f19eea272849065d5dd21104f6fa7c7e385ed9cf8fbb518c59088bc48f5fdc",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {
                "6379/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "6379"
                    }
                ]
            },
            "SandboxKey": "/var/run/docker/netns/62f19eea2728",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "f0d51b78c34b598b27fef608c824974407bdf235a4d289e23f935aa87d906ef9",
            "Gateway": "172.17.0.1",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "172.17.0.3",
            "IPPrefixLen": 16,
            "IPv6Gateway": "",
            "MacAddress": "02:42:ac:11:00:03",
            "Networks": {
                "bridge": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "b3c2da1a7455de3deac167a7759678f293f5e9a8e886375867b7c64c30e12935",
                    "EndpointID": "f0d51b78c34b598b27fef608c824974407bdf235a4d289e23f935aa87d906ef9",
                    "Gateway": "172.17.0.1",
                    "IPAddress": &q

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...