您现在的位置:首页 > 系统运维 > Linux运维

在Centos7下 使用docker安装谷歌浏览器访问内网环境

总有一些朋友有这个需求,想通过一个简单的方法,远程打开linux系统内的浏览器来访问路由器等内网环境,于是就有了这个!
一、安装docker

[root@centos7 ~]# curl -sSL ht...

总有一些朋友有这个需求,想通过一个简单的方法,远程打开linux系统内的浏览器来访问路由器等内网环境,于是就有了这个!

一、安装docker


[root@centos7 ~]# curl -sSL https://get.daocloud.io/docker | sh

[root@centos7 ~]# docker --version					#查看版本
Docker version 20.10.5, build 55c4c88
[root@centos7 ~]# docker run hello-world			#测试是否成功
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b8dfde127a29: Pull complete 
Digest: sha256:308866a43596e83578c7dfa15e27a73011bdd402185a84c5cd7f32a88b501a24
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

[root@centos7 ~]# docker run ubuntu:15.10 /bin/echo "Hello world"		#docker使用ubuntu基本命令
Unable to find image 'ubuntu:15.10' locally	
15.10: Pulling from library/ubuntu
7dcf5a444392: Pull complete 
759aa75f3cee: Pull complete 
3fa871dc8a2b: Pull complete 
224c42ae46e7: Pull complete 
Digest: sha256:02521a2d079595241c6793b2044f02eecf294034f31d6e235ac4b2b54ffc41f3
Status: Downloaded newer image for ubuntu:15.10
Hello world
[root@centos7 ~]# docker run ubuntu:15.10 /bin/echo "Hello world"		#docker使用ubuntu基本命令
Hello world
[root@centos7 ~]# docker run -i -t ubuntu:15.10 /bin/bash				#登录到ubuntu交互命令行
root@b39fc376e5f6:/# ls													#已经登录到docker系统内
bin  boot  dev  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var

二、容器运行谷歌浏览器


[root@centos7 ~]# docker run -d --name firefox -p 8083:8083 -p 5900:5900 oldiy/chrome-novnc:latest
Unable to find image 'oldiy/chrome-novnc:latest' locally
latest: Pulling from oldiy/chrome-novnc
38e2e6cd5626: Pull complete 
705054bc3f5b: Pull complete 
c7051e069564: Pull complete 
7308e914506c: Pull complete 
ea71b6fc716d: Pull complete 
ef61d50828ea: Pull complete 
0790e813eae6: Pull complete 
c930629b6efd: Pull complete 
0d1c4c101d63: Pull complete 
6326f24a39b1: Pull complete 
Digest: sha256:1e2262ca4eaddda551cff7add26a8cf1d7d5e84bbc3ad5d18034f345b1d34536
Status: Downloaded newer image for oldiy/chrome-novnc:latest
c88fdb88c1abc0cd5c115a03bbba6757b986b9d75155e4ca3874f0ecbe5b9ed4
[root@centos7 ~]# 
[root@centos7 ~]# 


可以看到下面:
tcp        0      0 0.0.0.0:5900            0.0.0.0:*               LISTEN      7677/docker-proxy  
上面就是docker创建的谷歌浏览器,使用vnc访问5900端口即可

[root@centos7 ~]# netstat  -lnpt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:52389           0.0.0.0:*               LISTEN      2040/tp_core        
tcp        0      0 127.0.0.1:2601          0.0.0.0:*               LISTEN      773/zebra           
tcp        0      0 0.0.0.0:5900            0.0.0.0:*               LISTEN      7677/docker-proxy   
tcp        0      0 127.0.0.1:2604          0.0.0.0:*               LISTEN      787/ospfd           
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      684/rpcbind         
tcp        0      0 127.0.0.1:52080         0.0.0.0:*               LISTEN      2040/tp_core        
tcp        0      0 0.0.0.0:8083            0.0.0.0:*               LISTEN      7666/docker-proxy   
tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN      1884/dnsmasq        
tcp        0      0 0.0.0.0:7190            0.0.0.0:*               LISTEN      1331/tp_web         
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1241/sshd           
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      1244/cupsd          
tcp        0      0 0.0.0.0:52089           0.0.0.0:*               LISTEN      2040/tp_core        
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1565/master         
tcp        0      0 0.0.0.0:52189           0.0.0.0:*               LISTEN      2040/tp_core        
tcp6       0      0 :::3306                 :::*                    LISTEN      2165/mysqld         
tcp6       0      0 :::111                  :::*                    LISTEN      684/rpcbind         
tcp6       0      0 :::22                   :::*                    LISTEN      1241/sshd           
tcp6       0      0 ::1:631                 :::*                    LISTEN      1244/cupsd          
tcp6       0      0 ::1:25                  :::*                    LISTEN      1565/master

三、使用vnc访问谷歌浏览器

如果防火墙在运行中,则需要提前配置好防火墙策略:


firewall-cmd --zone=public --add-port=5900/tcp --permanent			#开放端口
firewall-cmd --reload												#刷新防火墙配置		

VNC登录如下

登录效果如下:

版权所有
侵权必究

上一篇
学习记录之-linux中find命令的几种用法
下一篇
IPV6地址的批量ping测试工具,基于Python的multiping模块