在docker中体验和了解memcached的感觉
使用memcached图片
只需要使用Docker Hub上的memcached,就能轻松进行尝试。
$ docker run --name my-memcache -d -p 11211:11211 memcached
e502fab0fe92a15b060df17b2900c09d14d0c3c84a03e6f10f8c8ea3786a54f7
$ telnet localhost 11211
Trying ::1...
Connected to localhost.
Escape character is '^]'.
set hoge 0 100 4
piyo
STORED
get hoge
VALUE hoge 0 4
piyo
END
quit
Connection closed by foreign host.
使用CentOS镜像
另一种方法是在CentOS上使用yum install memcached进行安装。
FROM centos:6
RUN yum install -y memcached telnet
$ docker build -t memcached-study .
$ docker run -it --rm --name memcached-study memcached-study bash
# service memcached start
# telnet localhost 11211
以上です。总之,Docker非常方便。谢谢。