In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces how to use link in docker, the content is very detailed, interested friends can refer to, hope to be helpful to you.
Create a dockerfile. In this article, the dockerfile is named Dockerfile_memcached (the file name can be defined at will):
# Memcached## VERSION 2.2FROM ubuntu:12.04MAINTAINER Marker.King # make sure the package repository is up to dateRUN echo "deb http://mirrors.aliyun.com/ubuntu precise main universe" > / etc/apt/sources.listRUN apt-get update# install memcachedRUN apt-get install-y memcached# Launch memcached when launching the containerENTRYPOINT ["memcached"] # run memcached as the daemon userUSER daemon# expose memcached portEXPOSE 11211
Build an image based on dockerfile:
$docker build-t memecached-
< Dockerfile_memcached 使用构建的镜像启动容器: $ docker run -d -name memcached_service memcached 根据镜像启动一个shell交互方式的容器,连接memcached服务,ubuntu_with_pip是我预先安装了pip的一个镜像: $ docker run -i -t -link memcached_service:db ubuntu_with_pip:12.04 /bin/bash 查看shell交互容器的环境变量: root@665f1bdc5913:/# envHOSTNAME=665f1bdc5913DB_NAME=/compassionate_pasteur/dbTERM=xtermDB_PORT=tcp://172.17.0.2:11211DB_PORT_11211_TCP_PROTO=tcpDB_PORT_11211_TCP_ADDR=172.17.0.2PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/binPWD=/SHLVL=1HOME=/DB_PORT_11211_TCP_PORT=11211DB_PORT_11211_TCP=tcp://172.17.0.2:11211container=lxc_=/usr/bin/env 安装python-memcached,并通过python测试是否能够正常使用: root@665f1bdc5913:/# pip install python-memcachedroot@665f1bdc5913:/# python>> > import memcache > mc = memcache.Client (["172.17.0.2 print 11211"], debug=0) > mc.set ("MDM", "Marker.King") True > value = mc.get ("MDM") > print (value) Marker.King about how to use link in docker is shared here. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.