dockerfile制作python3.6+mysql5.6+r
2022-03-25 本文已影响0人
柠檬C927
简单记录一下,Python3.6+mysql5.6+redis镜像的dockerfile文件,在上一篇HttprunnnerManager镜像制作有用到,这里只是拆分出来而已
# 基础镜像
FROM silverlogic/python3.6
# 描述
MAINTAINER python3.6+mysql5.6+redis
# 添加必要秘钥,以便添加apt库 archive.ubuntu.com
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5
# 换中国源,其中archive.ubuntu.com用于安装mysql
RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak \
&& echo "deb http://mirrors.163.com/debian/ stretch main non-free contrib" >> /etc/apt/sources.list \
&& echo "deb http://mirrors.163.com/debian/ stretch-updates main non-free contrib" >>/etc/apt/sources.list \
&& echo "deb-src http://mirrors.163.com/debian/ stretch main non-free contrib" >>/etc/apt/sources.list \
&& echo "deb-src http://mirrors.163.com/debian/ stretch-updates main non-free contrib" >>/etc/apt/sources.list \
&& echo "deb http://archive.ubuntu.com/ubuntu trusty universe" >>/etc/apt/sources.list \
&& apt-get update
# 安装mysql5.6
RUN { \
echo mysql-server mysql-server/root_password password '123456'; \
echo mysql-server mysql-server/root_password_again password '123456'; \
} | debconf-set-selections \
&& apt-get install -y mysql-server-5.6 mysql-client-5.6
# 装redis
RUN apt install -y redis-server
# 启动命令
ENTRYPOINT service mysql start && redis-server # 让进程一直跑, 否则容器会exit