DockerFile部署lnmp+memcached+redis+mongodb开发环境for Memcached

Posted 93bok

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了DockerFile部署lnmp+memcached+redis+mongodb开发环境for Memcached相关的知识,希望对你有一定的参考价值。

本文源链接地址:https://www.93bok.com

1、下载基础镜像centos
docker pull centos:6
2、查看一下大小
docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
centos              6                   70b5d81549ec        2 months ago        195MB
3、创建文件夹存放Memcached的Dockerfile,以及源码包等等,为后期docker-compose做准备
mkdir -p /data/docker/lnmp-test/dockerfile/memcached
4、创建Mongodb的Dockerfile
vim /data/docker/lnmp-test/dockerfile/memcached/Dockerfile
FROM centos:6

LABEL maintainer="[email protected]" description="Memcached image"

COPY memcached-1.4.31.tar.gz /root/memcached-1.4.31.tar.gz

RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 && yum -y install libevent-devel                   gcc && tar -zxvf /root/memcached-1.4.31.tar.gz -C /root/ && cd /root/memcached-1.4.31 && ./configure --prefix=/usr/local/memcached && make -j $(getconf _NPROCESSORS_ONLN) && make install && useradd memcached && ln -s /usr/local/memcached/bin/* /usr/local/bin/ && rm -rf /root/memcached* && yum clean all

USER memcached

EXPOSE 11211

CMD ["memcached"]
5、把memcached源码包上传到/data/docker/lnmp-test/dockerfile/memcached/目录下
6、创建镜像
cd /data/docker/lnmp-test/dockerfile/memcached/
docker build -t centos6:memcached .
7、查看镜像大小
docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
centos6             memcached           0dc1f48c7ac7        11 seconds ago      379MB
centos              6                   70b5d81549ec        3 months ago        195MB
8、启动容器测试是否成功
docker run -d -p 11211:11211 --name memcached centos6:memcached

技术分享图片

9、宿主机开启防火墙11211端口
firewall-cmd --add-port=11211/tcp --permanent
systemctl restart firewalld

以上是关于DockerFile部署lnmp+memcached+redis+mongodb开发环境for Memcached的主要内容,如果未能解决你的问题,请参考以下文章

DockerFile部署lnmp+memcached+redis+mongodb开发环境for MySQL

DockerFile部署lnmp+memcached+redis+mongodb开发环境for Redis

DockerFile部署lnmp+memcached+redis+mongodb开发环境for Nginx

DockerFile部署lnmp+memcached+redis+mongodb开发环境for PHP

部署网站运行平台LNMP + Memcached缓存

LNMP动静分离&&memcache缓存服务器