How does a Redis container in Docker operate on a connection?

Source: Internet
Author: User
Tags docker ps install redis

How does a Redis container in Docker operate on a connection? 1. Login Putty has the following information:

Public virtual IP (VIP) address
42.159.156.115
Internal IP Address
10.205.178.22
IP Address for eth0:10.205.178.22
IP Address for docker0:172.17.42.1


2. Download http://download.redis.io/redis-stable/redis.conf Modify the following fields

# Requirepass foobared Get rid of comments, foobared change to their own password password

3. Change and upload to https://www.sendspace.com/

Download Link
Https://www.sendspace.com/file/p1j6ac
Copy Link
Delete File Link
Https://www.sendspace.com/delete/p1j6ac/9e70e7f78a89601d5658ccbdc4834c43

Click on the link under "Download link" and the new page copy "Click here to start Download from SendSpace:" Links: https://fs10n2.sendspace.com/dl/ 03acafeeb8a1b799798666d55267a9cd/54a419057626bfac/p1j6ac/redis.conf (Be careful not to click!) If you click Please refresh the page again, each download will change)

4. Running a mapped Redis

sudo docker run-t-i-p 172.17.42.1:6379:6379 Redis:latest/bin/bash

Note: The IP address here is Docker's IP address


5. Download the Conf file and run the Redis-server

Cd/usr/local/bin
Curl-o redis.conf https://fs10n2.sendspace.com/dl/03acafeeb8a1b799798666d55267a9cd/54a419057626bfac/p1j6ac/redis.conf
Note: If there are errors in parentheses, try more times if Meet:curl: (6) couldn ' t resolve host ' fs10n3.sendspace.com ')

Redis-server redis.conf

6. After starting the Redis-server, turn off the putty7. Re-enter Putty8. For testing convenience directly in the machine to install a redis-server:

Apt-get Install Redis-server

9. Enter the container and set the value:

sudo docker ps-l

Docker-enter 4fb1f04d706c

Redis-cli-a Password

Set MyValue Valueindocker

Press Ctrl+d to exit the Docker container

10. Redis-server in Docker on the native connection;

Redis-cli-h 172.17.42.1-a Password

Get myvalue

"Valueindocker"

11. Also on how the public network accesses Docker, is attempting to:

Iptables-t nat-a prerouting-m tcp-p tcp--dport 12345-j DNAT--to-destination 172.17.42.1:6379
Iptables-t nat-a postrouting-m tcp-p tcp--dport 12345-d 172.17.42.1-j SNAT--to-source 42.159.156.115
Iptables-a input-p TCP--dport 12345-j ACCEPT

New progress will be notified to continue to send new articles, thank you!


5.

How does a Redis container in Docker operate on a connection?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.