您好,登錄后才能下訂單哦!
本篇內容介紹了“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-client yum install httpd yum install firewalld firewall-config
(2) 啟動服務后并加入開機自啟
## 啟動 systemctl start sshd systemctl start httpd systemctl start firewalld ## 開機自啟 systemctl enable sshd systemctl enable httpd systemctl 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:80 systemctl 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.conf AllowZoneDrifting=yes ====》》AllowZoneDrifting=no systemctl restart firewalld
(5)開放端口
firewall-cmd --permanent --add-port=8888/tcp firewall-cmd --reload firewall-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
針對以上報錯的解決方案:
### 升級setuptools pip3 install --upgrade setuptools -i https://mirrors.aliyun.com/pypi/simple/ ### 升級pip工具:https://www.cnblogs.com/rychh/p/16206842.html pip3 --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.local wssh --log-file-prefix=/data/webssh/wssh.log --timeout=500 --fbidhttp=false & chmod 777 /etc/rc.local
1、打包正在運行的容器為 image docker commit eeb6ee3f44bd webssh:dev 2、保存image到文件 docker save -o webssh_dev.tar webssh:dev 3、使用已保存的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”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識可以關注億速云網站,小編將為大家輸出更多高質量的實用文章!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。