[root@szht-pc ~]# cat ./memcached/Dockerfile FROM centos:centos6MAINTAINER jk409, jk409@qq.comRUN yum install -y memcachedENTRYPOINT ["memcached"]USER daemonEXPOSE 11211
FROM alpine:latestMAINTAINER alex alexwhen@gmail.comRUN apk --update add nginxCOPY . /usr/share/nginx/htmlEXPOSE 80CMD [“nginx”, “-g”, “daemon off;”]
#创建新的镜像:centos:memcached
docker build -t centos6:memcached ./memcached#运行新镜像:
docker run -d -p 11211:11211 centos6:memcached[root@szht-pc ~]# docker run -d -p 11211:11211 centos6:memcached#通过docker run/stop/start/kill container_id 来操作容器;#或者docker run -d -p 11211:11211 --name memcached centos6:memcached#这样可以通过docker run/stop/start/kill memcached,来运行、停止、启动、kill容器;f43a6dddc099aa66f1b601c85c1394a3800e1689a18490daf7a8c9c2acd359db[root@szht-pc ~]# netstat -antp|grep 11211tcp 0 0 :::11211 :::* LISTEN 7660/docker [root@szht-pc ~]#