当前位置:首页 » Mysql技术教程

This package contains sshd, pcal, mysql-client on Ubuntu14:04

2017-12-05 14:00 本站整理 浏览(0)

【How to build:】
cd /home/ops/work/demo/docker/aws/ubuntu
touch Dockerfile
docker build -t ubuntu_base:v1.0 .

【Test:】
docker run -p 10022:22 -d ubuntu_base:v1.0
ssh -p 10022 127.0.0.1

【Dockerfile:】
FROM ubuntu:14.04
MAINTAINER jbding <157517301@qq.com>
RUN apt-get update
RUN apt-get install -y openssh-server
RUN mkdir -p /var/run/sshd
RUN mkdir -p /root/.ssh

RUN sed -ri 's/session required pam_loginuid.so/#session required pam_loginuid.so/g' /etc/pam.d/sshd
ADD authorized_keys /root/.ssh/authorized_keys
ADD run.sh /run.sh
RUN chmod 755 /run.sh

RUN apt-get install -y pcal
RUN apt-get install -y mysql-client
RUN sed -Ei 's/^(bind-address|log)/#&/' /etc/mysql/my.cnf \
&& echo 'skip-host-cache\nskip-name-resolve' | awk '{ print } $1 == "[mysqld]" && c == 0 { c = 1; system("cat") }' /etc/mysql/my.cnf > /tmp/my.cnf \
&& mv /tmp/my.cnf /etc/mysql/my.cnf

EXPOSE 22
CMD ["/run.sh"]