docker 新容器修改

来源:互联网 发布:商场数据 编辑:程序博客网 时间:2024/06/05 22:52
1.下载 镜像文件
http://openvz.org/Download/template/precreated
下载 centos-6-x86_64.tar.gz (signature)

2.导入到 docker 上

3.ssh 连接不上
首先安装sshd 服务: yum -y install *ssh*
修改 ssh 配置文件:vim /etc/ssh/sshd_config

UsePAM no

PermitRootLogin yes

启动 ssh 服务:service sshd start

开机自启动: chkconfig --add sshd     chkconfig sshd on


注:不需要安装 sshd 服务也可以,全都通过 映射的形式,将你需要的东西都放在 宿主机上

如: 需要安装的软件 docker run -itd -v /user/src/soft/:/usr/src/soft/ --net=none --name=soft_test centos /bin/bash


4.安装 passwd

yum -y install passwd

passwd 运行设置密码


5.安装 vim vi

yum -y install vi vim


6.安装 net-tool ,wget

yum -y install net-tools.x86_64  (通过yum search ifconfig)

yum -y install wget


7.修改 镜像bash-4.1#

# vim ~/.bash_profile


# .bash_profile 

# Get the aliases and functions 

if [ -f ~/.bashrc ]; then 

        . ~/.bashrc 

fi


# vim ~/.bashrc

# .bashrc 

# Source global definitions 

if [ -f /etc/bashrc ]; then

         . /etc/bashrc

fi 

# User specific aliases and functions


source ~/.bash_profile; source ~/.bashrc


8.rsyslog 服务安装

yum -y install rsyslog

chkconfig --add rsyslog

chkconfig rsyslog on


9.碰到这种警告的时候,需要修改 docker 启动脚本配置

[WARNING] 082/032015 (572) : [/usr/local/haproxy/sbin/haproxy.main()] Cannot raise FD limit to 131088.

[WARNING] 082/032015 (572) : [/usr/local/haproxy/sbin/haproxy.main()] FD limit (1024) too low for maxconn=65535/maxsock=131088. Please raise 'ulimit-n' to 131088 or more to avoid any trouble.

解决:sudo sh -c 'printf "\nulimit -HSn 999999\n" >> /etc/sysconfig/docker'

sudo service docker restart


0 0
原创粉丝点击