7 Docker 运行 MongoDB 及 Redis

echo ‘root:shiyanlou‘ | chpasswd

RUN echo "deb http://mirrors.cloud.aliyuncs.com/ubuntu/ trusty main universe" > /etc/apt/sources.list

cd /home/shiyanlou
mkdir shiyanloumongodb shiyanlouredis
touch shiyanloumongodb/Dockerfile shiyanlouredis/Dockerfile

构建Dockerfile

# Version 0.1
# 基础镜像
FROM ubuntu:14.04
# 维护者信息
MAINTAINER shiyanlou@shiyanlou.com
# 镜像操作命令
RUN echo "deb http://mirrors.cloud.aliyuncs.com/ubuntu/ trusty main universe" > /etc/apt/sources.list
RUN apt-get update && apt-get install -yqq supervisor && apt-get clean
# 容器启动命令
CMD ["supervisord"]

在Mongodb下添加Dockerfile的内容

cd /home/shiyanlou/shiyanloumongodb/
vim Dockerfile

然后,实验安装所需要的软件包:
RUN apt-get install -yqq openssh-server openssh-client
创建运行目录:
RUN mkdir -p /var/run/sshd
设置 root 密码及允许 root 通过 ssh 登录

RUN echo ‘root:shiyanlou‘ | chpasswd
RUN sed -i ‘s/PermitRootLogin without-password/PermitRootLogin yes/‘ /etc/ssh/sshd_config

7 Docker 运行 MongoDB 及 Redis

上一篇:mySQL主从


下一篇:Codeforces Goodbye2020部分题解