欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Docker配置WebSSH的實(shí)現(xiàn)

 更新時(shí)間:2023年03月08日 09:40:40   作者:看得見的等候  
本文主要介紹了Docker配置WebSSH的實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧

1、基于DockerHub Centos鏡像

docker pull centos:centos7

2、 Centos鏡像存在的一個(gè)自身問(wèn)題:?jiǎn)?dòng)后的容器內(nèi)部無(wú)法使用systemctl命令

        Failed to get D-Bus connection: Operation not permitted

## docker run -dit eeb6ee3f44bd /bin/bash
## 切勿忘記宿主機(jī)防火墻開放8889 2200端口
docker run -dit -p 8889:8888 -p 2200:22 --restart=always --privileged --name t2 centos:centos7 init

3、在基礎(chǔ)鏡像中安裝基礎(chǔ)服務(wù)

(1)安裝sshd、httpd、firewalld服務(wù)

yum install -y openssh openssh-server openssh-client
yum install httpd
yum install firewalld firewall-config

(2) 啟動(dòng)服務(wù)后并加入開機(jī)自啟

## 啟動(dòng)
systemctl start sshd
systemctl start httpd
systemctl start firewalld
## 開機(jī)自啟
systemctl enable sshd
systemctl enable httpd
systemctl enable firewalld

(3)針對(duì)于httpd服務(wù)

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)針對(duì)于firewalld服務(wù)

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)設(shè)置默認(rèn)初始密碼:passwd root

 4、在基礎(chǔ)鏡像中配置WebSSH

(1)安裝python3

yum install python3-pip

(2)安裝WebSSH

##### pip3 install webssh
##### pip3 報(bào)錯(cuò):Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-xxx/xxx/ 
##### https://www.modb.pro/db/81767

 針對(duì)以上報(bào)錯(cuò)的解決方案:

### 升級(jí)setuptools
pip3 install --upgrade setuptools -i https://mirrors.aliyun.com/pypi/simple/
### 升級(jí)pip工具:https://www.cnblogs.com/rychh/p/16206842.html
pip3 --default-timeout=1000 install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple/

 額外針對(duì)于以下告警的處理可選擇性處理:

### 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

進(jìn)行安裝:

pip3 --default-timeout=1000 install webssh -i https://mirrors.aliyun.com/pypi/simple/

5、后臺(tái)啟動(dòng)并指定webssh服務(wù)的日志目錄

wssh --log-file-prefix=/data/webssh/wssh.log --timeout=500 --fbidhttp=false &

 6、加入開機(jī)自啟

vi /etc/rc.local
wssh --log-file-prefix=/data/webssh/wssh.log --timeout=500 --fbidhttp=false &
chmod 777 /etc/rc.local

 7、制作最終鏡像并在遷移后使用 

1、打包正在運(yùn)行的容器為 image
docker commit eeb6ee3f44bd webssh:dev
2、保存image到文件
docker save -o webssh_dev.tar webssh:dev
3、使用已保存的image文件
docker load --input webssh_dev.tar

 8、頁(yè)面訪問(wèn)

訪問(wèn)方式(1)如圖:

 訪問(wèn)方式(2)

## password需要進(jìn)行base64加密
http://ip:8889?hostname=ip&username=root&password=cm9vdA==&port=2200

備注:

## 查看容器啟動(dòng)日志
[vagrant@localhost images]$ sudo docker inspect --format '{{.LogPath}}' 21431ff039e7
/data/docker/containers/21431ff039e768753702d64cb01b1a75bb250c2c587b0f3396dd30b548a62850/21431ff039e768753702d64cb01b1a75bb250c2c587b0f3396dd30b548a62850-json.log

到此這篇關(guān)于Docker配置WebSSH的實(shí)現(xiàn)的文章就介紹到這了,更多相關(guān)Docker配置WebSSH內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • 阿里云ECS部署Docker服務(wù)的實(shí)現(xiàn)步驟

    阿里云ECS部署Docker服務(wù)的實(shí)現(xiàn)步驟

    本文主要介紹了阿里云ECS部署Docker服務(wù)的實(shí)現(xiàn)步驟,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2022-06-06
  • 使用minikube安裝k8s單節(jié)點(diǎn)集群方式

    使用minikube安裝k8s單節(jié)點(diǎn)集群方式

    本文主要介紹了minikube的使用方法,包括安裝、啟動(dòng)、鏡像管理等步驟,minikube是一個(gè)專注于讓Kubernetes更易于學(xué)習(xí)和開發(fā)的本地Kubernetes環(huán)境,支持在macOS、Linux和Windows上快速設(shè)置本地Kubernetes集群
    2024-10-10
  • 導(dǎo)出與導(dǎo)入Docker的容器實(shí)現(xiàn)示例

    導(dǎo)出與導(dǎo)入Docker的容器實(shí)現(xiàn)示例

    本文主要介紹了導(dǎo)出與導(dǎo)入Docker的容器實(shí)現(xiàn)示例,文中通過(guò)示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-12-12
  • 解決docker搭建gitlab時(shí)容器不停重啟的問(wèn)題

    解決docker搭建gitlab時(shí)容器不停重啟的問(wèn)題

    這篇文章主要介紹了docker搭建gitlab時(shí)容器不停重啟的問(wèn)題,當(dāng)用docker log 查看日志時(shí),發(fā)現(xiàn)問(wèn)題是在于配置文件沒(méi)有權(quán)限創(chuàng)建的問(wèn)題,本文給大家分享解決方案,感興趣的朋友一起看看吧
    2022-05-05
  • 通過(guò)UI管理docker的方法

    通過(guò)UI管理docker的方法

    這篇文章主要介紹了通過(guò)UI管理docker的方法,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2018-09-09
  • 使用Docker搭建Java環(huán)境的步驟方法

    使用Docker搭建Java環(huán)境的步驟方法

    本篇文章主要介紹了使用Docker搭建Java環(huán)境的步驟方法,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2017-11-11
  • docker程序鏡像的安裝流程

    docker程序鏡像的安裝流程

    鏡像相當(dāng)于容器的"源代碼",docker 鏡像文件類似于 Java 類模板,而 docker 容器實(shí)例類似于 Java 中 new 出來(lái)的實(shí)例對(duì)象,這篇文章主要介紹了docker程序鏡像的安裝,需要的朋友可以參考下
    2024-01-01
  • Docker容器添加映射端口的兩種實(shí)現(xiàn)方法

    Docker容器添加映射端口的兩種實(shí)現(xiàn)方法

    本文主要介紹了Docker容器添加映射端口的兩種實(shí)現(xiàn)方法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2023-07-07
  • 定時(shí)清理docker私服鏡像的方法

    定時(shí)清理docker私服鏡像的方法

    這篇文章主要介紹了定時(shí)清理docker私服鏡像的方法,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2019-08-08
  • 最新IDEA快速實(shí)現(xiàn)Docker鏡像部署運(yùn)行的過(guò)程詳解

    最新IDEA快速實(shí)現(xiàn)Docker鏡像部署運(yùn)行的過(guò)程詳解

    這篇文章主要介紹了最新IDEA快速實(shí)現(xiàn)Docker鏡像部署運(yùn)行的過(guò)程,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2020-09-09

最新評(píng)論