docker配置sshd服務
阿新 • • 發佈:2018-12-19
啟動一個centos服務
[email protected]:/data# docker run --privileged -itd --name centos_lnmp1.14 -p 8088:80 -p 33006:3306 centos /usr/sbin/init
[email protected]:/data# docker exec -it 97aaee886614 /bin/bash
[[email protected] /]#yum install -y gcc-c++ gcc openssl openssl-devel pcre-devel pcre openssh opsnssh-devel opsnssh-server openssh-* wget curl net-tools make sed
[ [email protected] /]# sed -i '[email protected]#Port [email protected] [email protected]' /etc/ssh/sshd_config
我的此處的sshd預設是開啟服務的 重新啟動是不可以啟動的需要手動kill掉sshd服務
[[email protected] /]# ss -tunlp |awk -F',' '{print $2}'|awk -F"=" '{print $2}'
[[email protected] /]# kill -p pid
[email protected] /]# systemctl restart sshd
docker 中 centos /etc/rc.d/init.d/functions: No such file or directory 錯誤,解決
[[email protected] /]#rpm -qf /etc/init.d/functions
[[email protected] /]#yum install -y initscripts