本篇内容介绍了“Docker如何配置WEBssh”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!1、基于DockerHub Centos镜像d
本篇内容介绍了“Docker如何配置WEBssh”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
docker pull centos:centos7
Failed to get D-Bus connection: Operation not permitted
## docker run -dit eeb6ee3f44bd /bin/bash## 切勿忘记宿主机防火墙开放8889 2200端口docker run -dit -p 8889:8888 -p 2200:22 --restart=always --privileged --name t2 centos:centos7 init
(1)安装sshd、Httpd、firewalld服务
yum install -y openssh openssh-server openssh-clientyum install httpdyum install firewalld firewall-config
(2) 启动服务后并加入开机自启
## 启动systemctl start sshdsystemctl start httpdsystemctl start firewalld## 开机自启systemctl enable sshdsystemctl enable httpdsystemctl enable firewalld
(3)针对于httpd服务
localhost.localdomain httpd[1953]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
vi /etc/httpd/conf/httpd.conf 加入一句:ServerName localhost:80systemctl restart httpd
(4)针对于firewalld服务
WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration option. It will be removed in a future release. Please consider disabling it now
vi /etc/firewalld/firewalld.confAllowZoneDrifting=yes ====》》AllowZoneDrifting=nosystemctl restart firewalld
(5)开放端口
firewall-cmd --permanent --add-port=8888/tcpfirewall-cmd --reloadfirewall-cmd --list-all
(6)设置默认初始密码:passwd root
(1)安装python3
yum install python3-pip
(2)安装WebSSH
##### pip3 install webssh##### pip3 报错:Command "Python setup.py egg_info" failed with error code 1 in /tmp/pip-build-xxx/xxx/ ##### https://www.modb.pro/db/81767
针对以上报错的解决方案:
### 升级setuptoolspip3 install --upgrade setuptools -i https://mirrors.aliyun.com/pypi/simple/### 升级pip工具:https://www.cnblogs.com/rychh/p/16206842.htmlpip3 --default-timeout=1000 install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple/
额外针对于以下告警的处理可选择性处理:
### WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
### https://blog.csdn.net/m0_58782029/article/details/129049587
进行安装:
pip3 --default-timeout=1000 install webssh -i https://mirrors.aliyun.com/pypi/simple/
wssh --log-file-prefix=/data/webssh/wssh.log --timeout=500 --fbidhttp=false &
vi /etc/rc.localwssh --log-file-prefix=/data/webssh/wssh.log --timeout=500 --fbidhttp=false &chmod 777 /etc/rc.local
1、打包正在运行的容器为 imagedocker commit eeb6ee3f44bd webssh:dev2、保存image到文件docker save -o webssh_dev.tar webssh:dev3、使用已保存的image文件docker load --input webssh_dev.tar
访问方式(1)如图:
访问方式(2)
## passWord需要进行base64加密http://ip:8889?hostname=ip&username=root&password=cm9vdA==&port=2200
备注:
## 查看容器启动日志[vagrant@localhost images]$ sudo docker inspect --fORMat '{{.LogPath}}' 21431ff039e7/data/docker/containers/21431ff039e768753702d64cb01b1a75bb250c2c587b0f3396dd30b548a62850/21431ff039e768753702d64cb01b1a75bb250c2c587b0f3396dd30b548a62850-JSON.log
“Docker如何配置WebSSH”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注编程网网站,小编将为大家输出更多高质量的实用文章!
--结束END--
本文标题: Docker如何配置WebSSH
本文链接: https://www.lsjlt.com/news/351060.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-04-30
2024-04-30
2024-04-30
2024-04-30
2024-04-30
2024-04-30
2024-04-30
2024-04-30
2024-04-30
2024-04-30
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0