Linux企业应用——Docker(五)之Docker网络

文章目录

  • 一、三种原生网络
    • 1.bridge桥接模式
    • 2.host模式
    • 3.none模式
  • 二、Docker自定义网络
    • 1.创建
    • 2.容器互访
    • 3.自定义网络,设置自定义网段和网关
    • 4.创建容器自定义ip
  • 三、容器的通信
    • 1.Joined容器
    • 2. --link
  • 三、跨主机网络通信
    • macvlan网络方案实现

清除所有的不用的镜像、容器、数据卷、网络

dcoekr system prune

一、三种原生网络


[root@k8s2 harbor]# docker network ls
NETWORK ID     NAME      DRIVER    SCOPE
696489daaaf3   bridge    bridge    local
daf109ce4ab0   host      host      local
41928efc6031   none      null      local

1.bridge桥接模式

• bridge模式下容器没有一个公有ip,只有宿主机可以直接访问,外部主机
是不可见的。
• 容器通过宿主机的NAT规则后可以访问外网。
Linux企业应用——Docker(五)之Docker网络_第1张图片

[root@k8s2 harbor]# docker run -it --rm busybox
/ # ip addr
1: lo: ,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
23: eth0@if24: ,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 qdisc noqueue
    link/ether 02:42:ac:11:00:02 brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.2/16 brd 172.17.255.255 scope global eth0
       valid_lft forever preferred_lft forever

yum install -y bridge-utils

docker安装时会创建一个名为 docker0 的Linux bridge,新建的容器
会自动桥接到这个接口。


[root@k8s2 harbor]# brctl show
bridge name     bridge id               STP enabled     interfaces
docker0         8000.02425d314189       no
[root@k8s2 harbor]# ip addr
1: lo: ,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: eth0: ,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:16:3e:09:e9:3a brd ff:ff:ff:ff:ff:ff
    inet 172.27.84.9/20 brd 172.27.95.255 scope global dynamic eth0
       valid_lft 315359423sec preferred_lft 315359423sec
3: docker0: ,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
    link/ether 02:42:5d:31:41:89 brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever

防火墙策略查看

[root@k8s2 harbor]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy DROP)
target     prot opt source               destination
DOCKER-USER  all  --  anywhere             anywhere
DOCKER-ISOLATION-STAGE-1  all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
DOCKER     all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Chain DOCKER (1 references)
target     prot opt source               destination

Chain DOCKER-ISOLATION-STAGE-1 (1 references)
target     prot opt source               destination
DOCKER-ISOLATION-STAGE-2  all  --  anywhere             anywhere
RETURN     all  --  anywhere             anywhere

Chain DOCKER-ISOLATION-STAGE-2 (1 references)
target     prot opt source               destination
DROP       all  --  anywhere             anywhere
RETURN     all  --  anywhere             anywhere

Chain DOCKER-USER (1 references)
target     prot opt source               destination
RETURN     all  --  anywhere             anywhere

[root@k8s2 harbor]# docker run -d --name vm1 nginx
69935dabfb2a1f059b8ed97c7a2da1c58825a7bdc4edc84f79b2e55eff950d99
[root@k8s2 harbor]# docker ps
CONTAINER ID   IMAGE     COMMAND                  CREATED         STATUS         PORTS     NAMES
69935dabfb2a   nginx     "/docker-entrypoint.…"   4 seconds ago   Up 3 seconds   80/tcp    vm1
[root@k8s2 harbor]# docker inspect vm1|grep Pid
            "Pid": 11664,
            "PidMode": "",
            "PidsLimit": null,
[root@k8s2 harbor]# cd /proc/11664
[root@k8s2 11664]# ls
attr        cmdline          environ  io         mem         ns             pagemap      sched      stack    task
autogroup   comm             exe      limits     mountinfo   numa_maps      patch_state  schedstat  stat     timers
auxv        coredump_filter  fd       loginuid   mounts      oom_adj        personality  sessionid  statm    uid_map
cgroup      cpuset           fdinfo   map_files  mountstats  oom_score      projid_map   setgroups  status   wchan
clear_refs  cwd              gid_map  maps       net         oom_score_adj  root         smaps      syscall
[root@k8s2 11664]# cd ns/
[root@k8s2 ns]# ls
ipc  mnt  net  pid  user  uts

docker inspect vm1可查看vm1容器被分配到ip地址

Linux企业应用——Docker(五)之Docker网络_第2张图片
宿主机可以直接访问,但其他主机不能访问


[root@k8s2 ns]# curl 172.17.0.2
<!DOCTYPE html>


Welcome to nginx!<<span class="token operator">/</span>title>
<style>
html <span class="token punctuation">{</span> color-scheme: light dark<span class="token punctuation">;</span> <span class="token punctuation">}</span>
body <span class="token punctuation">{</span> width: 35em<span class="token punctuation">;</span> margin: 0 auto<span class="token punctuation">;</span>
font-family: Tahoma<span class="token punctuation">,</span> Verdana<span class="token punctuation">,</span> Arial<span class="token punctuation">,</span> sans-serif<span class="token punctuation">;</span> <span class="token punctuation">}</span>
<<span class="token operator">/</span>style>
<<span class="token operator">/</span>head>
<body>
<h1>Welcome to nginx!<<span class="token operator">/</span>h1>
<p><span class="token keyword">If</span> you see this page<span class="token punctuation">,</span> the nginx web server is successfully installed and
working<span class="token punctuation">.</span> Further configuration is required<span class="token punctuation">.</span><<span class="token operator">/</span>p>

<p><span class="token keyword">For</span> online documentation and support please refer to
<a href=<span class="token string">"http://nginx.org/"</span>>nginx<span class="token punctuation">.</span>org<<span class="token operator">/</span>a><span class="token punctuation">.</span><br/>
Commercial support is available at
<a href=<span class="token string">"http://nginx.com/"</span>>nginx<span class="token punctuation">.</span>com<<span class="token operator">/</span>a><span class="token punctuation">.</span><<span class="token operator">/</span>p>

<p><em>Thank you <span class="token keyword">for</span> <span class="token keyword">using</span> nginx<span class="token punctuation">.</span><<span class="token operator">/</span>em><<span class="token operator">/</span>p>
<<span class="token operator">/</span>body>
<<span class="token operator">/</span>html>

</code></pre> 
  <h2>2.host模式</h2> 
  <p>host模式可以让容器共享宿主机网络栈,这样的好处是外部主机与容<br> 器直接通信,但是容器的网络缺少隔离性。<br> <a href="http://img.e-com-net.com/image/info8/33ea345691f14356be116efbb2b55790.jpg" target="_blank"><img src="http://img.e-com-net.com/image/info8/33ea345691f14356be116efbb2b55790.jpg" alt="Linux企业应用——Docker(五)之Docker网络_第3张图片" width="650" height="533" style="border:1px solid black;"></a></p> 
  <p><code>docker inspect vm2</code>vm2没有被分到IP地址,因为它和宿主机<mark>共享网络栈</mark></p> 
  <p><a href="http://img.e-com-net.com/image/info8/269ffa78b17f4e089ed6be5582496a11.jpg" target="_blank"><img src="http://img.e-com-net.com/image/info8/269ffa78b17f4e089ed6be5582496a11.jpg" alt="Linux企业应用——Docker(五)之Docker网络_第4张图片" width="650" height="609" style="border:1px solid black;"></a></p> 
  <p>使用<mark>其他主机</mark><code>curl 172.27.86.9</code>访问该宿主机,能直接到达vm2容器</p> 
  <p><a href="http://img.e-com-net.com/image/info8/9a869e2e5ff74af79d7545f545d876bf.jpg" target="_blank"><img src="http://img.e-com-net.com/image/info8/9a869e2e5ff74af79d7545f545d876bf.jpg" alt="Linux企业应用——Docker(五)之Docker网络_第5张图片" width="650" height="515" style="border:1px solid black;"></a><br> 弊端,当创建多个容器时,<mark>容器运行起冲突</mark></p> 
  <pre><code class="prism language-powershell"><span class="token namespace">[root@k8s2 ns]</span><span class="token comment"># docker run -d --name vm3 --network host nginx</span>
98791f547c93cdf385e3488d74b721cd946526bd0d0827fa8bc0806acc9c3a14
<span class="token namespace">[root@k8s2 ns]</span><span class="token comment"># docker ps</span>
CONTAINER ID   IMAGE     COMMAND                  CREATED              STATUS              PORTS     NAMES
8879ed66ee64   nginx     <span class="token string">"/docker-entrypoint.…"</span>   About a minute ago   Up About a minute             vm2

</code></pre> 
  <p><code>docker logs vm3</code>端口80冲突<br> <a href="http://img.e-com-net.com/image/info8/9740646b683546aaa033fa1777dd0de2.jpg" target="_blank"><img src="http://img.e-com-net.com/image/info8/9740646b683546aaa033fa1777dd0de2.jpg" alt="Linux企业应用——Docker(五)之Docker网络_第6张图片" width="650" height="518" style="border:1px solid black;"></a></p> 
  <h2>3.none模式</h2> 
  <p>none模式是指禁用网络功能,只有lo接口,在容器创建时使用–network=none指定。<br> 主要用来做网络隔离,在容器内存储密钥之类。</p> 
  <pre><code class="prism language-powershell"><span class="token namespace">[root@k8s2 ns]</span><span class="token comment"># docker run -it --rm --network none busybox</span>
<span class="token operator">/</span> <span class="token comment"># ip addr</span>
1: lo: <LOOPBACK<span class="token punctuation">,</span>UP<span class="token punctuation">,</span>LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>1/8 scope host lo
       valid_lft forever preferred_lft forever
<span class="token operator">/</span> <span class="token comment">#</span>

</code></pre> 
  <h1>二、Docker自定义网络</h1> 
  <h2>1.创建</h2> 
  <pre><code class="prism language-powershell">
<span class="token namespace">[root@k8s2 ns]</span><span class="token comment"># docker run -d --name vm1 nginx</span>
f8a491eb153f8e8482165f7ee3188fd97fae1c8698adefa6bcb39ea0b13337dc
<span class="token namespace">[root@k8s2 ns]</span><span class="token comment"># docker run -d --name vm2 nginx</span>
3673ada86dfc0c52af1d8711811b78ac64473e067fdc09608f2557d52050eff9
<span class="token namespace">[root@k8s2 ns]</span><span class="token comment"># docker ps</span>
CONTAINER ID   IMAGE     COMMAND                  CREATED         STATUS         PORTS     NAMES
3673ada86dfc   nginx     <span class="token string">"/docker-entrypoint.…"</span>   2 seconds ago   Up 2 seconds   80/tcp    vm2
f8a491eb153f   nginx     <span class="token string">"/docker-entrypoint.…"</span>   6 seconds ago   Up 5 seconds   80/tcp    vm1

</code></pre> 
  <p><a href="http://img.e-com-net.com/image/info8/5b140aac9a6b41c2bb75725286994066.jpg" target="_blank"><img src="http://img.e-com-net.com/image/info8/5b140aac9a6b41c2bb75725286994066.jpg" alt="Linux企业应用——Docker(五)之Docker网络_第7张图片" width="650" height="871" style="border:1px solid black;"></a></p> 
  <p><a href="http://img.e-com-net.com/image/info8/de88ecc12f2d44719d701a1db7a8311b.jpg" target="_blank"><img src="http://img.e-com-net.com/image/info8/de88ecc12f2d44719d701a1db7a8311b.jpg" alt="Linux企业应用——Docker(五)之Docker网络_第8张图片" width="650" height="667" style="border:1px solid black;"></a><br> 容器的ip地址是流动的,关闭又启动后的<mark>地址分配</mark>,是单调递增的</p> 
  <pre><code class="prism language-powershell">
<span class="token namespace">[root@k8s2 ns]</span><span class="token comment"># docker stop vm1</span>
vm1
<span class="token namespace">[root@k8s2 ns]</span><span class="token comment"># docker stop vm2</span>
vm2
<span class="token namespace">[root@k8s2 ns]</span><span class="token comment"># docker start vm2</span>
vm2
<span class="token namespace">[root@k8s2 ns]</span><span class="token comment"># docker start vm1</span>
vm1

</code></pre> 
  <p><a href="http://img.e-com-net.com/image/info8/428c0b3904cc47b9816ff332a0b3ecc7.jpg" target="_blank"><img src="http://img.e-com-net.com/image/info8/428c0b3904cc47b9816ff332a0b3ecc7.jpg" alt="Linux企业应用——Docker(五)之Docker网络_第9张图片" width="650" height="498" style="border:1px solid black;"></a><br> <a href="http://img.e-com-net.com/image/info8/640a8769eb6d4725b82327d6047071ff.jpg" target="_blank"><img src="http://img.e-com-net.com/image/info8/640a8769eb6d4725b82327d6047071ff.jpg" alt="Linux企业应用——Docker(五)之Docker网络_第10张图片" width="650" height="473" style="border:1px solid black;"></a><br> 创建一个自己的网络mynet1</p> 
  <pre><code class="prism language-powershell"><span class="token namespace">[root@k8s2 ns]</span><span class="token comment"># docker network create mynet1</span>
7b3f43033e18c7fe601b4467d44f21ee38e6fe1fff53056c2140cd36f7f74984
<span class="token namespace">[root@k8s2 ns]</span><span class="token comment"># docker network ls</span>
NETWORK ID     NAME      DRIVER    SCOPE
696489daaaf3   bridge    bridge    local
daf109ce4ab0   host      host      local
7b3f43033e18   mynet1    bridge    local
41928efc6031   none      null      local

</code></pre> 
  <p><mark>可以发现容器内内嵌DNS,这为容器互访带来了便利</mark></p> 
  <pre><code class="prism language-powershell">
<span class="token namespace">[root@k8s2 ns]</span><span class="token comment"># docker run -it --rm --name vm3 --network mynet1 busybox</span>
<span class="token operator">/</span> <span class="token comment"># ip addr</span>
1: lo: <LOOPBACK<span class="token punctuation">,</span>UP<span class="token punctuation">,</span>LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>1/8 scope host lo
       valid_lft forever preferred_lft forever
38: eth0@if39: <BROADCAST<span class="token punctuation">,</span>MULTICAST<span class="token punctuation">,</span>UP<span class="token punctuation">,</span>LOWER_UP<span class="token punctuation">,</span>M-DOWN> mtu 1500 qdisc noqueue
    link/ether 02:42:<span class="token function">ac</span>:12:00:02 brd ff:ff:ff:ff:ff:ff
    inet 172<span class="token punctuation">.</span>18<span class="token punctuation">.</span>0<span class="token punctuation">.</span>2/16 brd 172<span class="token punctuation">.</span>18<span class="token punctuation">.</span>255<span class="token punctuation">.</span>255 scope global eth0
       valid_lft forever preferred_lft forever
<span class="token operator">/</span> <span class="token comment"># ping vm3</span>
PING vm3 <span class="token punctuation">(</span>172<span class="token punctuation">.</span>18<span class="token punctuation">.</span>0<span class="token punctuation">.</span>2<span class="token punctuation">)</span>: 56 <span class="token keyword">data</span> bytes
64 bytes <span class="token keyword">from</span> 172<span class="token punctuation">.</span>18<span class="token punctuation">.</span>0<span class="token punctuation">.</span>2: seq=0 ttl=64 time=0<span class="token punctuation">.</span>051 ms
64 bytes <span class="token keyword">from</span> 172<span class="token punctuation">.</span>18<span class="token punctuation">.</span>0<span class="token punctuation">.</span>2: seq=1 ttl=64 time=0<span class="token punctuation">.</span>085 ms
64 bytes <span class="token keyword">from</span> 172<span class="token punctuation">.</span>18<span class="token punctuation">.</span>0<span class="token punctuation">.</span>2: seq=2 ttl=64 time=0<span class="token punctuation">.</span>076 ms
64 bytes <span class="token keyword">from</span> 172<span class="token punctuation">.</span>18<span class="token punctuation">.</span>0<span class="token punctuation">.</span>2: seq=3 ttl=64 time=0<span class="token punctuation">.</span>079 ms
64 bytes <span class="token keyword">from</span> 172<span class="token punctuation">.</span>18<span class="token punctuation">.</span>0<span class="token punctuation">.</span>2: seq=4 ttl=64 time=0<span class="token punctuation">.</span>073 ms
64 bytes <span class="token keyword">from</span> 172<span class="token punctuation">.</span>18<span class="token punctuation">.</span>0<span class="token punctuation">.</span>2: seq=5 ttl=64 time=0<span class="token punctuation">.</span>079 ms
^C
<span class="token operator">--</span><span class="token operator">-</span> vm3 ping statistics <span class="token operator">--</span><span class="token operator">-</span>
6 packets transmitted<span class="token punctuation">,</span> 6 packets received<span class="token punctuation">,</span> 0% packet loss
round-trip min/avg/max = 0<span class="token punctuation">.</span>051/0<span class="token punctuation">.</span>073/0<span class="token punctuation">.</span>085 ms
<span class="token operator">/</span> <span class="token comment"># cat /etc/hosts</span>
127<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>1       localhost
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172<span class="token punctuation">.</span>18<span class="token punctuation">.</span>0<span class="token punctuation">.</span>2      ff96ef344507

</code></pre> 
  <h2>2.容器互访</h2> 
  <pre><code class="prism language-powershell">
<span class="token namespace">[root@k8s2 ns]</span><span class="token comment"># docker run -it --rm --name vm3 --network mynet1 busybox</span>
<span class="token operator">/</span> <span class="token comment"># ip addr</span>
1: lo: <LOOPBACK<span class="token punctuation">,</span>UP<span class="token punctuation">,</span>LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>1/8 scope host lo
       valid_lft forever preferred_lft forever
42: eth0@if43: <BROADCAST<span class="token punctuation">,</span>MULTICAST<span class="token punctuation">,</span>UP<span class="token punctuation">,</span>LOWER_UP<span class="token punctuation">,</span>M-DOWN> mtu 1500 qdisc noqueue
    link/ether 02:42:<span class="token function">ac</span>:12:00:03 brd ff:ff:ff:ff:ff:ff
    inet 172<span class="token punctuation">.</span>18<span class="token punctuation">.</span>0<span class="token punctuation">.</span>3/16 brd 172<span class="token punctuation">.</span>18<span class="token punctuation">.</span>255<span class="token punctuation">.</span>255 scope global eth0
       valid_lft forever preferred_lft forever
<span class="token operator">/</span> <span class="token comment"># ping web1</span>
PING web1 <span class="token punctuation">(</span>172<span class="token punctuation">.</span>18<span class="token punctuation">.</span>0<span class="token punctuation">.</span>2<span class="token punctuation">)</span>: 56 <span class="token keyword">data</span> bytes
64 bytes <span class="token keyword">from</span> 172<span class="token punctuation">.</span>18<span class="token punctuation">.</span>0<span class="token punctuation">.</span>2: seq=0 ttl=64 time=0<span class="token punctuation">.</span>102 ms
64 bytes <span class="token keyword">from</span> 172<span class="token punctuation">.</span>18<span class="token punctuation">.</span>0<span class="token punctuation">.</span>2: seq=1 ttl=64 time=0<span class="token punctuation">.</span>104 ms
64 bytes <span class="token keyword">from</span> 172<span class="token punctuation">.</span>18<span class="token punctuation">.</span>0<span class="token punctuation">.</span>2: seq=2 ttl=64 time=0<span class="token punctuation">.</span>098 ms
^C
<span class="token operator">--</span><span class="token operator">-</span> web1 ping statistics <span class="token operator">--</span><span class="token operator">-</span>
3 packets transmitted<span class="token punctuation">,</span> 3 packets received<span class="token punctuation">,</span> 0% packet loss
round-trip min/avg/max = 0<span class="token punctuation">.</span>098/0<span class="token punctuation">.</span>101/0<span class="token punctuation">.</span>104 ms
<span class="token operator">/</span> <span class="token comment"># cat /etc/hosts</span>
127<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>1       localhost
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172<span class="token punctuation">.</span>18<span class="token punctuation">.</span>0<span class="token punctuation">.</span>3      3d3a46782051
<span class="token operator">/</span> <span class="token comment"># exit</span>
<span class="token namespace">[root@k8s2 ns]</span><span class="token comment"># docker run -it --rm --name vm3 --network mynet1 busyboxplus</span>
<span class="token operator">/</span> <span class="token comment"># ip addr</span>
1: lo: <LOOPBACK<span class="token punctuation">,</span>UP<span class="token punctuation">,</span>LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>1/8 scope host lo
       valid_lft forever preferred_lft forever
44: eth0@if45: <BROADCAST<span class="token punctuation">,</span>MULTICAST<span class="token punctuation">,</span>UP<span class="token punctuation">,</span>LOWER_UP<span class="token punctuation">,</span>M-DOWN> mtu 1500 qdisc noqueue
    link/ether 02:42:<span class="token function">ac</span>:12:00:03 brd ff:ff:ff:ff:ff:ff
    inet 172<span class="token punctuation">.</span>18<span class="token punctuation">.</span>0<span class="token punctuation">.</span>3/16 brd 172<span class="token punctuation">.</span>18<span class="token punctuation">.</span>255<span class="token punctuation">.</span>255 scope global eth0
       valid_lft forever preferred_lft forever
<span class="token operator">/</span> <span class="token comment"># curl web1</span>
<<span class="token operator">!</span>DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!<<span class="token operator">/</span>title>
<style>
html <span class="token punctuation">{</span> color-scheme: light dark<span class="token punctuation">;</span> <span class="token punctuation">}</span>
body <span class="token punctuation">{</span> width: 35em<span class="token punctuation">;</span> margin: 0 auto<span class="token punctuation">;</span>
font-family: Tahoma<span class="token punctuation">,</span> Verdana<span class="token punctuation">,</span> Arial<span class="token punctuation">,</span> sans-serif<span class="token punctuation">;</span> <span class="token punctuation">}</span>
<<span class="token operator">/</span>style>
<<span class="token operator">/</span>head>
<body>
<h1>Welcome to nginx!<<span class="token operator">/</span>h1>
<p><span class="token keyword">If</span> you see this page<span class="token punctuation">,</span> the nginx web server is successfully installed and
working<span class="token punctuation">.</span> Further configuration is required<span class="token punctuation">.</span><<span class="token operator">/</span>p>

<p><span class="token keyword">For</span> online documentation and support please refer to
<a href=<span class="token string">"http://nginx.org/"</span>>nginx<span class="token punctuation">.</span>org<<span class="token operator">/</span>a><span class="token punctuation">.</span><br/>
Commercial support is available at
<a href=<span class="token string">"http://nginx.com/"</span>>nginx<span class="token punctuation">.</span>com<<span class="token operator">/</span>a><span class="token punctuation">.</span><<span class="token operator">/</span>p>

<p><em>Thank you <span class="token keyword">for</span> <span class="token keyword">using</span> nginx<span class="token punctuation">.</span><<span class="token operator">/</span>em><<span class="token operator">/</span>p>
<<span class="token operator">/</span>body>
<<span class="token operator">/</span>html>
<span class="token operator">/</span> <span class="token comment">#</span>

</code></pre> 
  <h2>3.自定义网络,设置自定义网段和网关</h2> 
  <p><code>--subnet</code>参数设置网段,<code>--gateway</code>设置网关</p> 
  <pre><code class="prism language-powershell">
<span class="token namespace">[root@k8s2 ns]</span><span class="token comment"># docker network create --subnet 30.0.0.0/24 --gateway 30.0.0.1 mynet2</span>
ff3d3c3e9d0284f0a96643398f0d41e23e5bd03bff4ee9438398349c4ebe532d
<span class="token namespace">[root@k8s2 ns]</span><span class="token comment"># docker inspect mynet2</span>
<span class="token punctuation">[</span>
    <span class="token punctuation">{</span>
        <span class="token string">"Name"</span>: <span class="token string">"mynet2"</span><span class="token punctuation">,</span>
        <span class="token string">"Id"</span>: <span class="token string">"ff3d3c3e9d0284f0a96643398f0d41e23e5bd03bff4ee9438398349c4ebe532d"</span><span class="token punctuation">,</span>
        <span class="token string">"Created"</span>: <span class="token string">"2022-11-04T15:39:31.816320337+08:00"</span><span class="token punctuation">,</span>
        <span class="token string">"Scope"</span>: <span class="token string">"local"</span><span class="token punctuation">,</span>
        <span class="token string">"Driver"</span>: <span class="token string">"bridge"</span><span class="token punctuation">,</span>
        <span class="token string">"EnableIPv6"</span>: false<span class="token punctuation">,</span>
        <span class="token string">"IPAM"</span>: <span class="token punctuation">{</span>
            <span class="token string">"Driver"</span>: <span class="token string">"default"</span><span class="token punctuation">,</span>
            <span class="token string">"Options"</span>: <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span>
            <span class="token string">"Config"</span>: <span class="token punctuation">[</span>
                <span class="token punctuation">{</span>
                    <span class="token string">"Subnet"</span>: <span class="token string">"30.0.0.0/24"</span><span class="token punctuation">,</span>
                    <span class="token string">"Gateway"</span>: <span class="token string">"30.0.0.1"</span>
                <span class="token punctuation">}</span>
            <span class="token punctuation">]</span>
        <span class="token punctuation">}</span><span class="token punctuation">,</span>
        <span class="token string">"Internal"</span>: false<span class="token punctuation">,</span>
        <span class="token string">"Attachable"</span>: false<span class="token punctuation">,</span>
        <span class="token string">"Ingress"</span>: false<span class="token punctuation">,</span>
        <span class="token string">"ConfigFrom"</span>: <span class="token punctuation">{</span>
            <span class="token string">"Network"</span>: <span class="token string">""</span>
        <span class="token punctuation">}</span><span class="token punctuation">,</span>
        <span class="token string">"ConfigOnly"</span>: false<span class="token punctuation">,</span>
        <span class="token string">"Containers"</span>: <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span>
        <span class="token string">"Options"</span>: <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span>
        <span class="token string">"Labels"</span>: <span class="token punctuation">{</span><span class="token punctuation">}</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">]</span>


</code></pre> 
  <h2>4.创建容器自定义ip</h2> 
  <p>• 使用<code>--ip参数</code>可以指定容器ip地址,但必须是在自定义网桥上,默认的bridge模式不支持,同一网桥上的容器是可以互通的。</p> 
  <pre><code class="prism language-powershell">
<span class="token namespace">[root@k8s2 ns]</span><span class="token comment"># docker run -it --rm --name vm3 --network mynet2 --ip 30.0.0.126 busyboxplus</span>
<span class="token operator">/</span> <span class="token comment"># ping 30.0.0.1</span>
PING 30<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>1 <span class="token punctuation">(</span>30<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>1<span class="token punctuation">)</span>: 56 <span class="token keyword">data</span> bytes
64 bytes <span class="token keyword">from</span> 30<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>1: seq=0 ttl=64 time=0<span class="token punctuation">.</span>107 ms
^C
<span class="token operator">--</span><span class="token operator">-</span> 30<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>1 ping statistics <span class="token operator">--</span><span class="token operator">-</span>
1 packets transmitted<span class="token punctuation">,</span> 1 packets received<span class="token punctuation">,</span> 0% packet loss
round-trip min/avg/max = 0<span class="token punctuation">.</span>107/0<span class="token punctuation">.</span>107/0<span class="token punctuation">.</span>107 ms

</code></pre> 
  <p>web1和vm3属于不同网桥,所以不互通</p> 
  <pre><code class="prism language-powershell"><span class="token namespace">[root@k8s2 ns]</span><span class="token comment"># docker run -it --rm --name vm3 --network mynet2 --ip 30.0.0.126 busyboxplus</span>
<span class="token operator">/</span> <span class="token comment"># ping web1</span>
ping: bad address <span class="token string">'web1'</span>

</code></pre> 
  <p>如何实现不同网桥互通?</p> 
  <p><a href="http://img.e-com-net.com/image/info8/f0f41ee62cad4d4ea11aa8e238c9f4e1.jpg" target="_blank"><img src="http://img.e-com-net.com/image/info8/f0f41ee62cad4d4ea11aa8e238c9f4e1.jpg" alt="Linux企业应用——Docker(五)之Docker网络_第11张图片" width="650" height="545" style="border:1px solid black;"></a><br> Ctrl+p+q将容器打入后台<br> <code>docker network connect mynet1 vm3</code>给容器再添加一块mynet1的网卡</p> 
  <pre><code class="prism language-powershell"><span class="token operator">/</span> <span class="token comment"># [root@k8s2 ns]# docker ps</span>
CONTAINER ID   IMAGE         COMMAND                  CREATED          STATUS          PORTS     NAMES
d90a71b34cd1   busyboxplus   <span class="token string">"/bin/sh"</span>                2 minutes ago    Up 2 minutes              vm3
f37215297f66   nginx         <span class="token string">"/docker-entrypoint.…"</span>   8 minutes ago    Up 8 minutes    80/tcp    web1
3673ada86dfc   nginx         <span class="token string">"/docker-entrypoint.…"</span>   16 minutes ago   Up 14 minutes   80/tcp    vm2
f8a491eb153f   nginx         <span class="token string">"/docker-entrypoint.…"</span>   16 minutes ago   Up 14 minutes   80/tcp    vm1
<span class="token namespace">[root@k8s2 ns]</span><span class="token comment"># docker network connect mynet1 vm3</span>
<span class="token namespace">[root@k8s2 ns]</span><span class="token comment"># docker attach vm3</span>
<span class="token operator">/</span> <span class="token comment"># ip addr</span>
1: lo: <LOOPBACK<span class="token punctuation">,</span>UP<span class="token punctuation">,</span>LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>1/8 scope host lo
       valid_lft forever preferred_lft forever
47: eth0@if48: <BROADCAST<span class="token punctuation">,</span>MULTICAST<span class="token punctuation">,</span>UP<span class="token punctuation">,</span>LOWER_UP<span class="token punctuation">,</span>M-DOWN> mtu 1500 qdisc noqueue
    link/ether 02:42:1e:00:00:7e brd ff:ff:ff:ff:ff:ff
    inet 30<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>126/24 brd 30<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>255 scope global eth0
       valid_lft forever preferred_lft forever
49: eth1@if50: <BROADCAST<span class="token punctuation">,</span>MULTICAST<span class="token punctuation">,</span>UP<span class="token punctuation">,</span>LOWER_UP<span class="token punctuation">,</span>M-DOWN> mtu 1500 qdisc noqueue
    link/ether 02:42:<span class="token function">ac</span>:12:00:03 brd ff:ff:ff:ff:ff:ff
    inet 172<span class="token punctuation">.</span>18<span class="token punctuation">.</span>0<span class="token punctuation">.</span>3/16 brd 172<span class="token punctuation">.</span>18<span class="token punctuation">.</span>255<span class="token punctuation">.</span>255 scope global eth1
       valid_lft forever preferred_lft forever
<span class="token operator">/</span> <span class="token comment"># ping web1</span>
PING web1 <span class="token punctuation">(</span>172<span class="token punctuation">.</span>18<span class="token punctuation">.</span>0<span class="token punctuation">.</span>2<span class="token punctuation">)</span>: 56 <span class="token keyword">data</span> bytes
64 bytes <span class="token keyword">from</span> 172<span class="token punctuation">.</span>18<span class="token punctuation">.</span>0<span class="token punctuation">.</span>2: seq=0 ttl=64 time=0<span class="token punctuation">.</span>112 ms
64 bytes <span class="token keyword">from</span> 172<span class="token punctuation">.</span>18<span class="token punctuation">.</span>0<span class="token punctuation">.</span>2: seq=1 ttl=64 time=0<span class="token punctuation">.</span>103 ms
^C
<span class="token operator">--</span><span class="token operator">-</span> web1 ping statistics <span class="token operator">--</span><span class="token operator">-</span>
2 packets transmitted<span class="token punctuation">,</span> 2 packets received<span class="token punctuation">,</span> 0% packet loss
round-trip min/avg/max = 0<span class="token punctuation">.</span>103/0<span class="token punctuation">.</span>107/0<span class="token punctuation">.</span>112 ms
<span class="token operator">/</span> <span class="token comment">#</span>

</code></pre> 
  <h1>三、容器的通信</h1> 
  <p>容器之间除了使用ip通信外,还可以使用容器名称通信。<br> • docker 1.10开始,内嵌了一个DNS server。<br> • dns解析功能必须在自定义网络中使用。<br> • 启动容器时使用 --name 参数指定容器名称</p> 
  <h2>1.Joined容器</h2> 
  <p>Joined容器一种较为特别的网络模式。处于这个模式下的 Docker 容器会共享一个网络栈,这样两个容器之<br> 间可以使用localhost高效快速通信。</p> 
  <p><a href="http://img.e-com-net.com/image/info8/5c2fde2d33fb4ae2a89f771a5da6a045.jpg" target="_blank"><img src="http://img.e-com-net.com/image/info8/5c2fde2d33fb4ae2a89f771a5da6a045.jpg" alt="Linux企业应用——Docker(五)之Docker网络_第12张图片" width="632" height="521" style="border:1px solid black;"></a><br> • 在容器创建时使用<code>--network=container:vm1</code>指定。(vm1指定的是运行的容器名)</p> 
  <pre><code class="prism language-powershell">
<span class="token namespace">[root@k8s2 ns]</span><span class="token comment"># docker run -it --name vm1 --network container:web1 busyboxplus</span>
<span class="token operator">/</span> <span class="token comment"># ip addr</span>
1: lo: <LOOPBACK<span class="token punctuation">,</span>UP<span class="token punctuation">,</span>LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>1/8 scope host lo
       valid_lft forever preferred_lft forever
40: eth0@if41: <BROADCAST<span class="token punctuation">,</span>MULTICAST<span class="token punctuation">,</span>UP<span class="token punctuation">,</span>LOWER_UP<span class="token punctuation">,</span>M-DOWN> mtu 1500 qdisc noqueue
    link/ether 02:42:<span class="token function">ac</span>:12:00:02 brd ff:ff:ff:ff:ff:ff
    inet 172<span class="token punctuation">.</span>18<span class="token punctuation">.</span>0<span class="token punctuation">.</span>2/16 brd 172<span class="token punctuation">.</span>18<span class="token punctuation">.</span>255<span class="token punctuation">.</span>255 scope global eth0
       valid_lft forever preferred_lft forever
<span class="token operator">/</span> <span class="token comment"># ping web1</span>
PING web1 <span class="token punctuation">(</span>172<span class="token punctuation">.</span>18<span class="token punctuation">.</span>0<span class="token punctuation">.</span>2<span class="token punctuation">)</span>: 56 <span class="token keyword">data</span> bytes
64 bytes <span class="token keyword">from</span> 172<span class="token punctuation">.</span>18<span class="token punctuation">.</span>0<span class="token punctuation">.</span>2: seq=0 ttl=64 time=0<span class="token punctuation">.</span>048 ms
64 bytes <span class="token keyword">from</span> 172<span class="token punctuation">.</span>18<span class="token punctuation">.</span>0<span class="token punctuation">.</span>2: seq=1 ttl=64 time=0<span class="token punctuation">.</span>080 ms
^C
<span class="token operator">--</span><span class="token operator">-</span> web1 ping statistics <span class="token operator">--</span><span class="token operator">-</span>
2 packets transmitted<span class="token punctuation">,</span> 2 packets received<span class="token punctuation">,</span> 0% packet loss
round-trip min/avg/max = 0<span class="token punctuation">.</span>048/0<span class="token punctuation">.</span>064/0<span class="token punctuation">.</span>080 ms
<span class="token operator">/</span> <span class="token comment"># curl localhost</span>
<<span class="token operator">!</span>DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!<<span class="token operator">/</span>title>
<style>
html <span class="token punctuation">{</span> color-scheme: light dark<span class="token punctuation">;</span> <span class="token punctuation">}</span>
body <span class="token punctuation">{</span> width: 35em<span class="token punctuation">;</span> margin: 0 auto<span class="token punctuation">;</span>
font-family: Tahoma<span class="token punctuation">,</span> Verdana<span class="token punctuation">,</span> Arial<span class="token punctuation">,</span> sans-serif<span class="token punctuation">;</span> <span class="token punctuation">}</span>
<<span class="token operator">/</span>style>
<<span class="token operator">/</span>head>
<body>
<h1>Welcome to nginx!<<span class="token operator">/</span>h1>
<p><span class="token keyword">If</span> you see this page<span class="token punctuation">,</span> the nginx web server is successfully installed and
working<span class="token punctuation">.</span> Further configuration is required<span class="token punctuation">.</span><<span class="token operator">/</span>p>

<p><span class="token keyword">For</span> online documentation and support please refer to
<a href=<span class="token string">"http://nginx.org/"</span>>nginx<span class="token punctuation">.</span>org<<span class="token operator">/</span>a><span class="token punctuation">.</span><br/>
Commercial support is available at
<a href=<span class="token string">"http://nginx.com/"</span>>nginx<span class="token punctuation">.</span>com<<span class="token operator">/</span>a><span class="token punctuation">.</span><<span class="token operator">/</span>p>

<p><em>Thank you <span class="token keyword">for</span> <span class="token keyword">using</span> nginx<span class="token punctuation">.</span><<span class="token operator">/</span>em><<span class="token operator">/</span>p>
<<span class="token operator">/</span>body>
<<span class="token operator">/</span>html>
<span class="token operator">/</span> <span class="token comment">#</span>

</code></pre> 
  <h2>2. --link</h2> 
  <pre><code class="prism language-powershell">
<span class="token namespace">[root@k8s2 ns]</span><span class="token comment"># docker run -d --name web1 nginx</span>
91c420704b24eeda1caebe7f33995a07b76c83dbb01184de22a6e803788188d1
<span class="token namespace">[root@k8s2 ns]</span><span class="token comment"># docker ps</span>
CONTAINER ID   IMAGE     COMMAND                  CREATED         STATUS         PORTS     NAMES
91c420704b24   nginx     <span class="token string">"/docker-entrypoint.…"</span>   5 seconds ago   Up 4 seconds   80/tcp    web1
<span class="token namespace">[root@k8s2 ns]</span><span class="token comment"># docker run -it --name vm1 --link web1:nginx busyboxplus</span>
<span class="token operator">/</span> <span class="token comment"># ip addr</span>
1: lo: <LOOPBACK<span class="token punctuation">,</span>UP<span class="token punctuation">,</span>LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>1/8 scope host lo
       valid_lft forever preferred_lft forever
57: eth0@if58: <BROADCAST<span class="token punctuation">,</span>MULTICAST<span class="token punctuation">,</span>UP<span class="token punctuation">,</span>LOWER_UP<span class="token punctuation">,</span>M-DOWN> mtu 1500 qdisc noqueue
    link/ether 02:42:<span class="token function">ac</span>:11:00:03 brd ff:ff:ff:ff:ff:ff
    inet 172<span class="token punctuation">.</span>17<span class="token punctuation">.</span>0<span class="token punctuation">.</span>3/16 brd 172<span class="token punctuation">.</span>17<span class="token punctuation">.</span>255<span class="token punctuation">.</span>255 scope global eth0
       valid_lft forever preferred_lft forever
<span class="token operator">/</span> <span class="token comment"># ping web1</span>
PING web1 <span class="token punctuation">(</span>172<span class="token punctuation">.</span>17<span class="token punctuation">.</span>0<span class="token punctuation">.</span>2<span class="token punctuation">)</span>: 56 <span class="token keyword">data</span> bytes
64 bytes <span class="token keyword">from</span> 172<span class="token punctuation">.</span>17<span class="token punctuation">.</span>0<span class="token punctuation">.</span>2: seq=0 ttl=64 time=0<span class="token punctuation">.</span>133 ms
64 bytes <span class="token keyword">from</span> 172<span class="token punctuation">.</span>17<span class="token punctuation">.</span>0<span class="token punctuation">.</span>2: seq=1 ttl=64 time=0<span class="token punctuation">.</span>101 ms
^C
<span class="token operator">--</span><span class="token operator">-</span> web1 ping statistics <span class="token operator">--</span><span class="token operator">-</span>
2 packets transmitted<span class="token punctuation">,</span> 2 packets received<span class="token punctuation">,</span> 0% packet loss
round-trip min/avg/max = 0<span class="token punctuation">.</span>101/0<span class="token punctuation">.</span>117/0<span class="token punctuation">.</span>133 ms
<span class="token operator">/</span> <span class="token comment">#</span>

</code></pre> 
  <p>容器解析查看<code>cat /etc/hosts</code>或者·env·(里面存储变量值)<br> 当容器地址改变时,解析同步变化,变量不变,容器重启后,变量才会改变</p> 
  <pre><code class="prism language-powershell">
<span class="token operator">/</span> <span class="token comment"># cat /etc/hosts</span>
127<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>1       localhost
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172<span class="token punctuation">.</span>17<span class="token punctuation">.</span>0<span class="token punctuation">.</span>2      nginx 91c420704b24 web1
172<span class="token punctuation">.</span>17<span class="token punctuation">.</span>0<span class="token punctuation">.</span>3      98279a1cd492
<span class="token operator">/</span> <span class="token comment"># env</span>
HOSTNAME=98279a1cd492
SHLVL=1
HOME=<span class="token operator">/</span>
NGINX_ENV_PKG_RELEASE=1~bullseye
NGINX_PORT_80_TCP=tcp:<span class="token operator">/</span><span class="token operator">/</span>172<span class="token punctuation">.</span>17<span class="token punctuation">.</span>0<span class="token punctuation">.</span>2:80
NGINX_ENV_NGINX_VERSION=1<span class="token punctuation">.</span>23<span class="token punctuation">.</span>2
NGINX_ENV_NJS_VERSION=0<span class="token punctuation">.</span>7<span class="token punctuation">.</span>7
TERM=xterm
PATH=<span class="token operator">/</span>usr/local/sbin:<span class="token operator">/</span>usr/local/bin:<span class="token operator">/</span>usr/sbin:<span class="token operator">/</span>usr/bin:<span class="token operator">/</span>sbin:<span class="token operator">/</span>bin
NGINX_PORT=tcp:<span class="token operator">/</span><span class="token operator">/</span>172<span class="token punctuation">.</span>17<span class="token punctuation">.</span>0<span class="token punctuation">.</span>2:80
NGINX_NAME=<span class="token operator">/</span>vm1/nginx
<span class="token function">PWD</span>=<span class="token operator">/</span>
NGINX_PORT_80_TCP_ADDR=172<span class="token punctuation">.</span>17<span class="token punctuation">.</span>0<span class="token punctuation">.</span>2
NGINX_PORT_80_TCP_PORT=80
NGINX_PORT_80_TCP_PROTO=tcp
<span class="token operator">/</span> <span class="token comment">#</span>

</code></pre> 
  <p><a href="http://img.e-com-net.com/image/info8/576c127be7b3432d8bf80a4cb2bfd122.jpg" target="_blank"><img src="http://img.e-com-net.com/image/info8/576c127be7b3432d8bf80a4cb2bfd122.jpg" alt="Linux企业应用——Docker(五)之Docker网络_第13张图片" width="650" height="344" style="border:1px solid black;"></a><br> • 外网如何访问容器:<br> • 端口映射<br> • -p 选项指定映射端口</p> 
  <pre><code class="prism language-powershell"><span class="token namespace">[root@k8s2 ns]</span><span class="token comment"># ps ax | grep dokcer-proxy</span>
 4632 pts/0    S+     0:00 grep <span class="token operator">--</span>color=auto dokcer-proxy
<span class="token namespace">[root@k8s2 ns]</span><span class="token comment"># docker run -d --name web2 -p 80:80 nginx</span>
1bbc2a10781df7efdd197fa27b436a11f052e1826f5ee5d5340d4fce8568aa15
<span class="token namespace">[root@k8s2 ns]</span><span class="token comment"># docker port web2</span>
80/tcp <span class="token operator">-</span>> 0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0:80
<span class="token namespace">[root@k8s2 ns]</span><span class="token comment"># ps ax | grep dokcer-proxy</span>
 5147 pts/0    S+     0:00 grep <span class="token operator">--</span>color=auto dokcer-proxy
<span class="token namespace">[root@k8s2 ns]</span><span class="token comment"># netstat -antlp| grep :80</span>
tcp        0      0 0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0:80              0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0:<span class="token operator">*</span>               LISTEN      4913/docker-proxy
tcp        0      0 172<span class="token punctuation">.</span>27<span class="token punctuation">.</span>84<span class="token punctuation">.</span>9:49624       100<span class="token punctuation">.</span>100<span class="token punctuation">.</span>30<span class="token punctuation">.</span>26:80        ESTABLISHED 1042/AliYunDun
<span class="token namespace">[root@k8s2 ns]</span><span class="token comment">#</span>

</code></pre> 
  <p>• 外网访问容器用到了docker-proxy和iptables DNAT<br> • 宿主机访问本机容器使用的是iptables DNAT<br> • 外部主机访问容器或容器之间的访问是docker-proxy实现<br> <a href="http://img.e-com-net.com/image/info8/dc4be31814c4409892ebbc0ddf285a50.jpg" target="_blank"><img src="http://img.e-com-net.com/image/info8/dc4be31814c4409892ebbc0ddf285a50.jpg" alt="Linux企业应用——Docker(五)之Docker网络_第14张图片" width="650" height="311" style="border:1px solid black;"></a></p> 
  <h1>三、跨主机网络通信</h1> 
  <p>跨主机网络解决方案<br> • docker原生的overlay和macvlan<br> • 第三方的flannel、weave、calico<br> • 众多网络方案是如何与docker集成在一起的<br> • libnetwork docker容器网络库<br> • CNM (Container Network Model)这个模型对容器网络进行了抽象</p> 
  <h2>macvlan网络方案实现</h2> 
  <p>• Linux kernel提供的一种网卡虚拟化技术。<br> • 无需Linux bridge,直接使用物理接口,性能极好</p> 
  <p><mark>在两台主机上</mark>激活网卡开启混杂模式</p> 
  <pre><code class="prism language-powershell">ip link <span class="token function">set</span> eth0 promisc on
</code></pre> 
  <p><mark>在两个主机上</mark>创建macvlan网络<br> 设置parent网络为eth0的子接口</p> 
  <pre><code class="prism language-powershell"> docker network create <span class="token operator">-</span>d macvlan <span class="token operator">--</span>subnet 20<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0/24 <span class="token operator">--</span>gateway 20<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>1 <span class="token operator">-</span>o parent=eth0<span class="token punctuation">.</span>1 macvlan1
</code></pre> 
  <p>一个主机</p> 
  <pre><code class="prism language-powershell">docker run <span class="token operator">-</span>it <span class="token operator">--</span><span class="token function">rm</span> <span class="token operator">--</span>name web1 <span class="token operator">--</span>network macvlan1 <span class="token operator">--</span>ip 20<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>11 busyboxplus
</code></pre> 
  <p>另一个主机</p> 
  <pre><code class="prism language-powershell"> docker run <span class="token operator">-</span>it <span class="token operator">--</span><span class="token function">rm</span> <span class="token operator">--</span>name vm1 <span class="token operator">--</span>network macvlan1 <span class="token operator">--</span>ip 20<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>11 busyboxplus
</code></pre> 
  <p>两台主机能互相ping通,实现通信</p> 
 </div> 
</div>
                            </div>
                        </div>
                    </div>
                    <!--PC和WAP自适应版-->
                    <div id="SOHUCS" sid="1646729461976096768"></div>
                    <script type="text/javascript" src="/views/front/js/chanyan.js"></script>
                    <!-- 文章页-底部 动态广告位 -->
                    <div class="youdao-fixed-ad" id="detail_ad_bottom"></div>
                </div>
                <div class="col-md-3">
                    <div class="row" id="ad">
                        <!-- 文章页-右侧1 动态广告位 -->
                        <div id="right-1" class="col-lg-12 col-md-12 col-sm-4 col-xs-4 ad">
                            <div class="youdao-fixed-ad" id="detail_ad_1"> </div>
                        </div>
                        <!-- 文章页-右侧2 动态广告位 -->
                        <div id="right-2" class="col-lg-12 col-md-12 col-sm-4 col-xs-4 ad">
                            <div class="youdao-fixed-ad" id="detail_ad_2"></div>
                        </div>
                        <!-- 文章页-右侧3 动态广告位 -->
                        <div id="right-3" class="col-lg-12 col-md-12 col-sm-4 col-xs-4 ad">
                            <div class="youdao-fixed-ad" id="detail_ad_3"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="container">
        <h4 class="pt20 mb15 mt0 border-top">你可能感兴趣的:(Linux企业运维,docker,linux,网络)</h4>
        <div id="paradigm-article-related">
            <div class="recommend-post mb30">
                <ul class="widget-links">
                    <li><a href="/article/1835513699826233344.htm"
                           title="android系统selinux中添加新属性property" target="_blank">android系统selinux中添加新属性property</a>
                        <span class="text-muted">辉色投像</span>

                        <div>1.定位/android/system/sepolicy/private/property_contexts声明属性开头:persist.charge声明属性类型:u:object_r:system_prop:s0图12.定位到android/system/sepolicy/public/domain.te删除neverallow{domain-init}default_prop:property</div>
                    </li>
                    <li><a href="/article/1835509391361667072.htm"
                           title="Linux下QT开发的动态库界面弹出操作(SDL2)" target="_blank">Linux下QT开发的动态库界面弹出操作(SDL2)</a>
                        <span class="text-muted">13jjyao</span>
<a class="tag" taget="_blank" href="/search/QT%E7%B1%BB/1.htm">QT类</a><a class="tag" taget="_blank" href="/search/qt/1.htm">qt</a><a class="tag" taget="_blank" href="/search/%E5%BC%80%E5%8F%91%E8%AF%AD%E8%A8%80/1.htm">开发语言</a><a class="tag" taget="_blank" href="/search/sdl2/1.htm">sdl2</a><a class="tag" taget="_blank" href="/search/linux/1.htm">linux</a>
                        <div>需求:操作系统为linux,开发框架为qt,做成需带界面的qt动态库,调用方为java等非qt程序难点:调用方为java等非qt程序,也就是说调用方肯定不带QApplication::exec(),缺少了这个,QTimer等事件和QT创建的窗口将不能弹出(包括opencv也是不能弹出);这与qt调用本身qt库是有本质的区别的思路:1.调用方缺QApplication::exec(),那么我们在接口</div>
                    </li>
                    <li><a href="/article/1835504596898902016.htm"
                           title="linux sdl windows.h,Windows下的SDL安装" target="_blank">linux sdl windows.h,Windows下的SDL安装</a>
                        <span class="text-muted">奔跑吧linux内核</span>
<a class="tag" taget="_blank" href="/search/linux/1.htm">linux</a><a class="tag" taget="_blank" href="/search/sdl/1.htm">sdl</a><a class="tag" taget="_blank" href="/search/windows.h/1.htm">windows.h</a>
                        <div>首先你要下载并安装SDL开发包。如果装在C盘下,路径为C:\SDL1.2.5如果在WINDOWS下。你可以按以下步骤:1.打开VC++,点击"Tools",Options2,点击directories选项3.选择"Includefiles"增加一个新的路径。"C:\SDL1.2.5\include"4,现在选择"Libaryfiles“增加"C:\SDL1.2.5\lib"现在你可以开始编写你的第</div>
                    </li>
                    <li><a href="/article/1835503712899002368.htm"
                           title="linux中sdl的使用教程,sdl使用入门" target="_blank">linux中sdl的使用教程,sdl使用入门</a>
                        <span class="text-muted">Melissa Corvinus</span>
<a class="tag" taget="_blank" href="/search/linux%E4%B8%ADsdl%E7%9A%84%E4%BD%BF%E7%94%A8%E6%95%99%E7%A8%8B/1.htm">linux中sdl的使用教程</a>
                        <div>本文通过一个简单示例讲解SDL的基本使用流程。示例中展示一个窗口,窗口里面有个随机颜色快随机移动。当我们鼠标点击关闭按钮时间窗口关闭。基本步骤如下:1.初始化SDL并创建一个窗口。SDL_Init()初始化SDL_CreateWindow()创建窗口2.纹理渲染存储RGB和存储纹理的区别:比如一个从左到右由红色渐变到蓝色的矩形,用存储RGB的话就需要把矩形中每个点的具体颜色值存储下来;而纹理只是一</div>
                    </li>
                    <li><a href="/article/1835502578050363392.htm"
                           title="PHP环境搭建详细教程" target="_blank">PHP环境搭建详细教程</a>
                        <span class="text-muted">好看资源平台</span>
<a class="tag" taget="_blank" href="/search/%E5%89%8D%E7%AB%AF/1.htm">前端</a><a class="tag" taget="_blank" href="/search/php/1.htm">php</a>
                        <div>PHP是一个流行的服务器端脚本语言,广泛用于Web开发。为了使PHP能够在本地或服务器上运行,我们需要搭建一个合适的PHP环境。本教程将结合最新资料,介绍在不同操作系统上搭建PHP开发环境的多种方法,包括Windows、macOS和Linux系统的安装步骤,以及本地和Docker环境的配置。1.PHP环境搭建概述PHP环境的搭建主要分为以下几类:集成开发环境:例如XAMPP、WAMP、MAMP,这</div>
                    </li>
                    <li><a href="/article/1835502451877310464.htm"
                           title="基于社交网络算法优化的二维最大熵图像分割" target="_blank">基于社交网络算法优化的二维最大熵图像分割</a>
                        <span class="text-muted">智能算法研学社(Jack旭)</span>
<a class="tag" taget="_blank" href="/search/%E6%99%BA%E8%83%BD%E4%BC%98%E5%8C%96%E7%AE%97%E6%B3%95%E5%BA%94%E7%94%A8/1.htm">智能优化算法应用</a><a class="tag" taget="_blank" href="/search/%E5%9B%BE%E5%83%8F%E5%88%86%E5%89%B2/1.htm">图像分割</a><a class="tag" taget="_blank" href="/search/%E7%AE%97%E6%B3%95/1.htm">算法</a><a class="tag" taget="_blank" href="/search/php/1.htm">php</a><a class="tag" taget="_blank" href="/search/%E5%BC%80%E5%8F%91%E8%AF%AD%E8%A8%80/1.htm">开发语言</a>
                        <div>智能优化算法应用:基于社交网络优化的二维最大熵图像阈值分割-附代码文章目录智能优化算法应用:基于社交网络优化的二维最大熵图像阈值分割-附代码1.前言2.二维最大熵阈值分割原理3.基于社交网络优化的多阈值分割4.算法结果:5.参考文献:6.Matlab代码摘要:本文介绍基于最大熵的图像分割,并且应用社交网络算法进行阈值寻优。1.前言阅读此文章前,请阅读《图像分割:直方图区域划分及信息统计介绍》htt</div>
                    </li>
                    <li><a href="/article/1835501948011376640.htm"
                           title="使用 FinalShell 进行远程连接(ssh 远程连接 Linux 服务器)" target="_blank">使用 FinalShell 进行远程连接(ssh 远程连接 Linux 服务器)</a>
                        <span class="text-muted">编程经验分享</span>
<a class="tag" taget="_blank" href="/search/%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/1.htm">开发工具</a><a class="tag" taget="_blank" href="/search/%E6%9C%8D%E5%8A%A1%E5%99%A8/1.htm">服务器</a><a class="tag" taget="_blank" href="/search/ssh/1.htm">ssh</a><a class="tag" taget="_blank" href="/search/linux/1.htm">linux</a>
                        <div>目录前言基本使用教程新建远程连接连接主机自定义命令路由追踪前言后端开发,必然需要和服务器打交道,部署应用,排查问题,查看运行日志等等。一般服务器都是集中部署在机房中,也有一些直接是云服务器,总而言之,程序员不可能直接和服务器直接操作,一般都是通过ssh连接来登录服务器。刚接触远程连接时,使用的是XSHELL来远程连接服务器,连接上就能够操作远程服务器了,但是仅用XSHELL并没有上传下载文件的功能</div>
                    </li>
                    <li><a href="/article/1835498349264990208.htm"
                           title="2023-04-17|篮球女孩" target="_blank">2023-04-17|篮球女孩</a>
                        <span class="text-muted">长一木</span>

                        <div>1小学抑或初中阶段,在课外书了解到她的故事。“篮球女孩”。当时佩服她的顽强,也对生命多了一丝敬畏。今天刚好在公众号看到,长大后的“篮球女孩”。佩服之余又满是心疼。网络侵删祝那素未蒙面的女孩,未来一切顺遂。</div>
                    </li>
                    <li><a href="/article/1835496780066811904.htm"
                           title="在一台Ubuntu计算机上构建Hyperledger Fabric网络" target="_blank">在一台Ubuntu计算机上构建Hyperledger Fabric网络</a>
                        <span class="text-muted">落叶无声9</span>
<a class="tag" taget="_blank" href="/search/%E5%8C%BA%E5%9D%97%E9%93%BE/1.htm">区块链</a><a class="tag" taget="_blank" href="/search/%E8%B6%85%E7%BA%A7%E8%B4%A6%E6%9C%AC/1.htm">超级账本</a><a class="tag" taget="_blank" href="/search/Hyperledger/1.htm">Hyperledger</a><a class="tag" taget="_blank" href="/search/fabric/1.htm">fabric</a><a class="tag" taget="_blank" href="/search/%E5%8C%BA%E5%9D%97%E9%93%BE/1.htm">区块链</a><a class="tag" taget="_blank" href="/search/ubuntu/1.htm">ubuntu</a><a class="tag" taget="_blank" href="/search/%E6%9E%84%E5%BB%BA/1.htm">构建</a><a class="tag" taget="_blank" href="/search/hyperledger/1.htm">hyperledger</a><a class="tag" taget="_blank" href="/search/fabric/1.htm">fabric</a>
                        <div>在一台Ubuntu计算机上构建HyperledgerFabric网络Hyperledgerfabric是一个开源的区块链应用程序平台,为开发基于区块链的应用程序提供了一个起点。当我们提到HyperledgerFabric网络时,我们指的是使用HyperledgerFabric的正在运行的系统。即使只使用最少数量的组件,部署Fabric网络也不是一件容易的事。Fabric社区创建了一个名为Cello</div>
                    </li>
                    <li><a href="/article/1835493373906087936.htm"
                           title="libyuv之linux编译" target="_blank">libyuv之linux编译</a>
                        <span class="text-muted">jaronho</span>
<a class="tag" taget="_blank" href="/search/Linux/1.htm">Linux</a><a class="tag" taget="_blank" href="/search/linux/1.htm">linux</a><a class="tag" taget="_blank" href="/search/%E8%BF%90%E7%BB%B4/1.htm">运维</a><a class="tag" taget="_blank" href="/search/%E6%9C%8D%E5%8A%A1%E5%99%A8/1.htm">服务器</a>
                        <div>文章目录一、下载源码二、编译源码三、注意事项1、银河麒麟系统(aarch64)(1)解决armv8-a+dotprod+i8mm指令集支持问题(2)解决armv9-a+sve2指令集支持问题一、下载源码到GitHub网站下载https://github.com/lemenkov/libyuv源码,或者用直接用git克隆到本地,如:gitclonehttps://github.com/lemenko</div>
                    </li>
                    <li><a href="/article/1835491354004779008.htm"
                           title="【华为OD技术面试真题 - 技术面】-测试八股文真题题库(1)" target="_blank">【华为OD技术面试真题 - 技术面】-测试八股文真题题库(1)</a>
                        <span class="text-muted">算法大师</span>
<a class="tag" taget="_blank" href="/search/%E5%8D%8E%E4%B8%BAod/1.htm">华为od</a><a class="tag" taget="_blank" href="/search/%E9%9D%A2%E8%AF%95/1.htm">面试</a><a class="tag" taget="_blank" href="/search/python/1.htm">python</a><a class="tag" taget="_blank" href="/search/%E7%AE%97%E6%B3%95/1.htm">算法</a><a class="tag" taget="_blank" href="/search/%E5%89%8D%E7%AB%AF/1.htm">前端</a>
                        <div>华为OD面试真题精选专栏:华为OD面试真题精选目录:2024华为OD面试手撕代码真题目录以及八股文真题目录文章目录华为OD面试真题精选1.黑盒测试和白盒测试的区别2.假设我们公司现在开发一个类似于微信的软件1.0版本,现在要你测试这个功能:打开聊天窗口,输入文本,限制字数在200字以内。问你怎么提取测试点。功能测试性能测试安全性测试可用性测试跨平台兼容性测试网络环境测试3.接口测试的工具你了解哪些</div>
                    </li>
                    <li><a href="/article/1835489588169240576.htm"
                           title="ARM驱动学习之5 LEDS驱动" target="_blank">ARM驱动学习之5 LEDS驱动</a>
                        <span class="text-muted">JT灬新一</span>
<a class="tag" taget="_blank" href="/search/%E5%B5%8C%E5%85%A5%E5%BC%8F/1.htm">嵌入式</a><a class="tag" taget="_blank" href="/search/C/1.htm">C</a><a class="tag" taget="_blank" href="/search/%E5%BA%95%E5%B1%82/1.htm">底层</a><a class="tag" taget="_blank" href="/search/arm%E5%BC%80%E5%8F%91/1.htm">arm开发</a><a class="tag" taget="_blank" href="/search/%E5%AD%A6%E4%B9%A0/1.htm">学习</a><a class="tag" taget="_blank" href="/search/%E5%8D%95%E7%89%87%E6%9C%BA/1.htm">单片机</a>
                        <div>ARM驱动学习之5LEDS驱动知识点:•linuxGPIO申请函数和赋值函数–gpio_request–gpio_set_value•三星平台配置GPIO函数–s3c_gpio_cfgpin•GPIO配置输出模式的宏变量–S3C_GPIO_OUTPUT注意点:DRIVER_NAME和DEVICE_NAME匹配。实现步骤:1.加入需要的头文件://Linux平台的gpio头文件#include//三</div>
                    </li>
                    <li><a href="/article/1835485681187647488.htm"
                           title="【华为OD技术面试真题精选 - 非技术题】 -HR面,综合面_华为od hr面" target="_blank">【华为OD技术面试真题精选 - 非技术题】 -HR面,综合面_华为od hr面</a>
                        <span class="text-muted">一个射手座的程序媛</span>
<a class="tag" taget="_blank" href="/search/%E7%A8%8B%E5%BA%8F%E5%91%98/1.htm">程序员</a><a class="tag" taget="_blank" href="/search/%E5%8D%8E%E4%B8%BAod/1.htm">华为od</a><a class="tag" taget="_blank" href="/search/%E9%9D%A2%E8%AF%95/1.htm">面试</a><a class="tag" taget="_blank" href="/search/%E8%81%8C%E5%9C%BA%E5%92%8C%E5%8F%91%E5%B1%95/1.htm">职场和发展</a>
                        <div>最后的话最近很多小伙伴找我要Linux学习资料,于是我翻箱倒柜,整理了一些优质资源,涵盖视频、电子书、PPT等共享给大家!资料预览给大家整理的视频资料:给大家整理的电子书资料:如果本文对你有帮助,欢迎点赞、收藏、转发给朋友,让我有持续创作的动力!网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。需要这份系统化的资料的朋友,可以点击这里获</div>
                    </li>
                    <li><a href="/article/1835485429059645440.htm"
                           title="docker" target="_blank">docker</a>
                        <span class="text-muted">igotyback</span>
<a class="tag" taget="_blank" href="/search/eureka/1.htm">eureka</a><a class="tag" taget="_blank" href="/search/%E4%BA%91%E5%8E%9F%E7%94%9F/1.htm">云原生</a>
                        <div>Docker容器的文件系统是隔离的,但是可以通过挂载卷(Volumes)或绑定挂载(BindMounts)将宿主机的文件系统目录映射到容器内部。要查看Docker容器的映射路径,可以使用以下方法:查看容器配置:使用dockerinspect命令可以查看容器的详细配置信息,包括挂载的卷。例如:bashdockerinspect在输出的JSON格式中,查找"Mounts"部分,这里会列出所有的挂载信息</div>
                    </li>
                    <li><a href="/article/1835484742221393920.htm"
                           title="《在战“疫”中成长致敬生活》观后感" target="_blank">《在战“疫”中成长致敬生活》观后感</a>
                        <span class="text-muted">梅子刘的刀</span>

                        <div>(作者:周晨)今天上午,我看了“我是接班人”网络大课堂《在战役中成长致敬生活》。有很多人拿出自己攒下的钱,默默地捐给了武汉,有几千块钱的、有几万块钱的,也有十几万块钱的。连小朋友也把自己的压岁钱捐给了武汉。有名环卫工人把自己五年的积蓄全部捐给了武汉。有名外卖小哥为医护人员买鞋子送吃的。还有已经治愈出院的新型肺炎病人捐了400毫升的血浆。还有位叫大树的叔叔,虽然他没有钱,但是他地里有蔬菜,捐了几大卡</div>
                    </li>
                    <li><a href="/article/1835482277870661632.htm"
                           title="简介Shell、zsh、bash" target="_blank">简介Shell、zsh、bash</a>
                        <span class="text-muted">zhaosuningsn</span>
<a class="tag" taget="_blank" href="/search/Shell/1.htm">Shell</a><a class="tag" taget="_blank" href="/search/zsh/1.htm">zsh</a><a class="tag" taget="_blank" href="/search/bash/1.htm">bash</a><a class="tag" taget="_blank" href="/search/shell/1.htm">shell</a><a class="tag" taget="_blank" href="/search/linux/1.htm">linux</a><a class="tag" taget="_blank" href="/search/bash/1.htm">bash</a>
                        <div>Shell是Linux和Unix的外壳,类似衣服,负责外界与Linux和Unix内核的交互联系。例如接收终端用户及各种应用程序的命令,把接收的命令翻译成内核能理解的语言,传递给内核,并把内核处理接收的命令的结果返回给外界,即Shell是外界和内核沟通的桥梁或大门。Linux和Unix提供了多种Shell,其中有种bash,当然还有其他好多种。Mac电脑中不但有bash,还有一个zsh,预装的,据说</div>
                    </li>
                    <li><a href="/article/1835479000600899584.htm"
                           title="Linux MariaDB使用OpenSSL安装SSL证书" target="_blank">Linux MariaDB使用OpenSSL安装SSL证书</a>
                        <span class="text-muted">Meta39</span>
<a class="tag" taget="_blank" href="/search/MySQL/1.htm">MySQL</a><a class="tag" taget="_blank" href="/search/Oracle/1.htm">Oracle</a><a class="tag" taget="_blank" href="/search/MariaDB/1.htm">MariaDB</a><a class="tag" taget="_blank" href="/search/Linux/1.htm">Linux</a><a class="tag" taget="_blank" href="/search/Windows/1.htm">Windows</a><a class="tag" taget="_blank" href="/search/ssl/1.htm">ssl</a><a class="tag" taget="_blank" href="/search/linux/1.htm">linux</a><a class="tag" taget="_blank" href="/search/mariadb/1.htm">mariadb</a>
                        <div>进入到证书存放目录,批量删除.pem证书警告:确保已经进入到证书存放目录find.-typef-iname\*.pem-delete查看是否安装OpenSSLopensslversion没有则安装yuminstallopensslopenssl-devel开启SSL编辑/etc/my.cnf文件(没有的话就创建,但是要注意,在/etc/my.cnf.d/server.cnf配置了datadir的,</div>
                    </li>
                    <li><a href="/article/1835475963543121920.htm"
                           title="中原焦点团队网络初中级30期阴丽丽坚持分享第三百八十八次2022.10.18分享 约练次数(74) 咨询师(6) 来访者(53) 观察者(15)" target="_blank">中原焦点团队网络初中级30期阴丽丽坚持分享第三百八十八次2022.10.18分享 约练次数(74) 咨询师(6) 来访者(53) 观察者(15)</a>
                        <span class="text-muted">阴丽丽</span>

                        <div>今天是忙碌的一天,一早起来,总想着找点把事情弄完,可总也弄不完。就这样弄着吧!孩子的事,自己的事都在那里搁置着,不想做,有点欧!今天总体还不错,只是在下午起床时走神了俩小时,也算是给自己的放松吧!今日难得1.儿子乖巧、听话,努力配合,一天下来也是忙忙碌碌,这真的很难得!2.儿子今天录的视频被班主任认可,这真的很难得3.我今天早上做核酸时,自己把教案整了一下,这真的很难得</div>
                    </li>
                    <li><a href="/article/1835473957185220608.htm"
                           title="网络编程基础" target="_blank">网络编程基础</a>
                        <span class="text-muted">记得开心一点啊</span>
<a class="tag" taget="_blank" href="/search/%E7%BD%91%E7%BB%9C/1.htm">网络</a>
                        <div>目录♫什么是网络编程♫Socket套接字♪什么是Socket套接字♪数据报套接字♪流套接字♫数据报套接字通信模型♪数据报套接字通讯模型♪DatagramSocket♪DatagramPacket♪实现UDP的服务端代码♪实现UDP的客户端代码♫流套接字通信模型♪流套接字通讯模型♪ServerSocket♪Socket♪实现TCP的服务端代码♪实现TCP的客户端代码♫什么是网络编程网络编程,指网络上</div>
                    </li>
                    <li><a href="/article/1835469294436184064.htm"
                           title="【从浅识到熟知Linux】Linux发展史" target="_blank">【从浅识到熟知Linux】Linux发展史</a>
                        <span class="text-muted">Jammingpro</span>
<a class="tag" taget="_blank" href="/search/%E4%BB%8E%E6%B5%85%E5%AD%A6%E5%88%B0%E7%86%9F%E7%9F%A5Linux/1.htm">从浅学到熟知Linux</a><a class="tag" taget="_blank" href="/search/linux/1.htm">linux</a><a class="tag" taget="_blank" href="/search/%E8%BF%90%E7%BB%B4/1.htm">运维</a><a class="tag" taget="_blank" href="/search/%E6%9C%8D%E5%8A%A1%E5%99%A8/1.htm">服务器</a>
                        <div>归属专栏:从浅学到熟知Linux个人主页:Jammingpro每日努力一点点,技术变化看得见文章前言:本篇文章记录Linux发展的历史,因在介绍Linux过程中涉及的其他操作系统及人物,本文对相关内容也有所介绍。文章目录Unix发展史Linux发展史开源Linux官网企业应用情况发行版本在学习Linux前,我们可能都会问Linux从哪里来?它是如何发展的。但在介绍Linux之前,需要先介绍一下Un</div>
                    </li>
                    <li><a href="/article/1835468963086168064.htm"
                           title="多子女家庭问题" target="_blank">多子女家庭问题</a>
                        <span class="text-muted">3e5c5362403c</span>

                        <div>杨宁宁焦点解决网络初17中19坚持分享589天(2021.3.20)本周约练我1次,总计166次,读书打卡第256天案例督导收获:【家有老大篇】被爱与高期待下的独舞家里的第一个孩子往往集万千宠爱于一身。爸爸妈妈、爷爷奶奶、姥姥姥爷的目光都聚焦在他的身上。在这种光环下长大的孩子,就如小皇帝一般,衣来伸手、饭来张口。拥有爱的同时,也意味着拥有了更高的被期待,父母会花血本给你报各种各样的早教班,给你买各</div>
                    </li>
                    <li><a href="/article/1835468833360539648.htm"
                           title="父母教育孩子的方式,将影响孩子一生" target="_blank">父母教育孩子的方式,将影响孩子一生</a>
                        <span class="text-muted">树英教育</span>

                        <div>为什么有些孩子总是充满自信与快乐?独立、有主见又坚强?而有些孩子却自卑、胆怯,软弱又过度依赖父母?为什么有些孩子总是健康、阳光又富于创造力?而有些孩子却悲观、孤僻又思想空乏?一个孩子的行为取决于孩子的思想,思想取决于环境和自己的认知,认知取决于教育。父母是孩子人生中的第一位教育者,父母养育孩子的方式,将决定他们人生的高度,影响他们的一生。网络图,侵权即删优秀的父母就像园丁,既要浇水施肥,又要修剪杂</div>
                    </li>
                    <li><a href="/article/1835467782687387648.htm"
                           title="linux 发展史" target="_blank">linux 发展史</a>
                        <span class="text-muted">种树的猴子</span>
<a class="tag" taget="_blank" href="/search/%E5%86%85%E6%A0%B8/1.htm">内核</a><a class="tag" taget="_blank" href="/search/java/1.htm">java</a><a class="tag" taget="_blank" href="/search/%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F/1.htm">操作系统</a><a class="tag" taget="_blank" href="/search/linux/1.htm">linux</a><a class="tag" taget="_blank" href="/search/%E5%A4%A7%E6%95%B0%E6%8D%AE/1.htm">大数据</a>
                        <div>linux发展史说明此前对linux认识模糊一知半解,近期通过学习将自己对于linux的发展总结一下方便大家日后的学习。那Linux是目前一款非常火热的开源操作系统,可是linux是什么时候出现的,又是因为什么样的原因被开发出来的呢。以下将对linux的发展历程进行详细的讲解。目录一、Linux发展背景二、UINIX的诞生三、UNIX的重要分支-BSD的诞生四、Minix的诞生五、GNU与Free</div>
                    </li>
                    <li><a href="/article/1835466523163062272.htm"
                           title="Linux sh命令" target="_blank">Linux sh命令</a>
                        <span class="text-muted">fengyehongWorld</span>
<a class="tag" taget="_blank" href="/search/Linux/1.htm">Linux</a><a class="tag" taget="_blank" href="/search/linux/1.htm">linux</a>
                        <div>目录一.基本语法二.选项2.1-c字符串中读取内容,并执行2.1.1基本用法2.1.2获取当前目录下失效的超链接2.2-x每个命令执行之前,将其打印出来2.3结合Here文档使用一.基本语法⏹Linux和Unix系统中用于执行shell脚本或运行命令的命令。sh[选项][脚本文件][参数...]⏹选项-c:从字符串中读取内容,并执行。-x:在每个命令执行之前,将其打印出来。-s:从标准流中读取内容</div>
                    </li>
                    <li><a href="/article/1835466270955368448.htm"
                           title="Linux vi常用命令" target="_blank">Linux vi常用命令</a>
                        <span class="text-muted">fengyehongWorld</span>
<a class="tag" taget="_blank" href="/search/Linux/1.htm">Linux</a><a class="tag" taget="_blank" href="/search/linux/1.htm">linux</a>
                        <div>参考资料viコマンド(vimコマンド)リファレンス目录一.保存系命令二.删除系命令三.移动系命令四.复制粘贴系命令一.保存系命令⏹保存并退出:wq⏹强制保存并退出:wq!⏹退出(文件未编辑):q⏹强制退出(忽略已编辑内容):q!⏹另存为:w新文件名二.删除系命令⏹删除当前行dd⏹清空整个文档gg:移动到文档顶部dG:删除到最后一行ggdG三.移动系命令⏹移动到文档顶部gg⏹移动到文档底部#方式1G</div>
                    </li>
                    <li><a href="/article/1835463115882459136.htm"
                           title="2024.9.6 Python,华为笔试题总结,字符串格式化,字符串操作,广度优先搜索解决公司组织绩效互评问题,无向图" target="_blank">2024.9.6 Python,华为笔试题总结,字符串格式化,字符串操作,广度优先搜索解决公司组织绩效互评问题,无向图</a>
                        <span class="text-muted">RaidenQ</span>
<a class="tag" taget="_blank" href="/search/python/1.htm">python</a><a class="tag" taget="_blank" href="/search/%E5%8D%8E%E4%B8%BA/1.htm">华为</a><a class="tag" taget="_blank" href="/search/leetcode/1.htm">leetcode</a><a class="tag" taget="_blank" href="/search/%E7%AE%97%E6%B3%95/1.htm">算法</a><a class="tag" taget="_blank" href="/search/%E5%8A%9B%E6%89%A3/1.htm">力扣</a><a class="tag" taget="_blank" href="/search/%E5%B9%BF%E5%BA%A6%E4%BC%98%E5%85%88/1.htm">广度优先</a><a class="tag" taget="_blank" href="/search/%E6%97%A0%E5%90%91%E5%9B%BE/1.htm">无向图</a>
                        <div>1.字符串格式化name="Alice"age=30formatted_string="Name:{},Age:{}".format(name,age)print(formatted_string)或者name="Alice"age=30formatted_string=f"Name:{name},Age:{age}"print(formatted_string)2.网络健康检查第一行有两个整数m</div>
                    </li>
                    <li><a href="/article/1835463094311153664.htm"
                           title="戴容容 中原焦点团队.网络初级第33期,坚持分享第19天 2022年3月9日" target="_blank">戴容容 中原焦点团队.网络初级第33期,坚持分享第19天 2022年3月9日</a>
                        <span class="text-muted">TessDai</span>

                        <div>《每个人眼中的世界都是不同的》“一千个人眼里有一千个哈姆雷特”世界是多元的,每个人都有自己的道理,人人按照自己的理解去看待这个世界的人和物.我们如此,其他人也是如此.因此,任何事情,我们要放下自己以为的真理,去理解他人认为的真理,只有同频方能共振.孩子在慢慢长大的过程中慢慢学会独立,甚至对抗.尤其当孩子处于青春期的时候,他们开始有很多自己独立的想法,和一些特立独行的做法,家长常常会觉得不可思议,觉</div>
                    </li>
                    <li><a href="/article/1835461728423473152.htm"
                           title="第1步win10宿主机与虚拟机通过NAT共享上网互通" target="_blank">第1步win10宿主机与虚拟机通过NAT共享上网互通</a>
                        <span class="text-muted">学习3人组</span>
<a class="tag" taget="_blank" href="/search/%E5%A4%A7%E6%95%B0%E6%8D%AE/1.htm">大数据</a><a class="tag" taget="_blank" href="/search/%E5%A4%A7%E6%95%B0%E6%8D%AE/1.htm">大数据</a>
                        <div>VM的CentOS采用NAT共用宿主机网卡宿主机器无法连接到虚拟CentOS要实现宿主机与虚拟机通信,原理就是给宿主机的网卡配置一个与虚拟机网关相同网段的IP地址,实现可以互通。1、查看虚拟机的IP地址2、编辑虚拟机的虚拟网络的NAT和DHCP的配置,设置虚拟机的网卡选择NAT共享模式3、宿主机的IP配置,确保vnet8的IPV4属性与虚拟机在同一网段4、ping测试连通性[root@localh</div>
                    </li>
                    <li><a href="/article/1835456812720156672.htm"
                           title="网络通信流程" target="_blank">网络通信流程</a>
                        <span class="text-muted">记得开心一点啊</span>
<a class="tag" taget="_blank" href="/search/%E6%9C%8D%E5%8A%A1%E5%99%A8/1.htm">服务器</a><a class="tag" taget="_blank" href="/search/%E7%BD%91%E7%BB%9C/1.htm">网络</a><a class="tag" taget="_blank" href="/search/%E8%BF%90%E7%BB%B4/1.htm">运维</a>
                        <div>目录♫IP地址♫子网掩码♫MAC地址♫相关设备♫ARP寻址♫网络通信流程♫IP地址我们已经知道IP地址由网络号+主机号组成,根据IP地址的不同可以有5钟划分网络号和主机号的方案:其中,各类地址的表示范围是:分类范围适用网络网络数量主机最大连接数A类0.0.0.0~127.255.255.255大型网络12616777214【(2^24)-2】B类128.0.0.0~191.255.255.255中</div>
                    </li>
                    <li><a href="/article/1835454921990828032.htm"
                           title="Java爬虫框架(一)--架构设计" target="_blank">Java爬虫框架(一)--架构设计</a>
                        <span class="text-muted">狼图腾-狼之传说</span>
<a class="tag" taget="_blank" href="/search/java/1.htm">java</a><a class="tag" taget="_blank" href="/search/%E6%A1%86%E6%9E%B6/1.htm">框架</a><a class="tag" taget="_blank" href="/search/java/1.htm">java</a><a class="tag" taget="_blank" href="/search/%E4%BB%BB%E5%8A%A1/1.htm">任务</a><a class="tag" taget="_blank" href="/search/html%E8%A7%A3%E6%9E%90%E5%99%A8/1.htm">html解析器</a><a class="tag" taget="_blank" href="/search/%E5%AD%98%E5%82%A8/1.htm">存储</a><a class="tag" taget="_blank" href="/search/%E7%94%B5%E5%AD%90%E5%95%86%E5%8A%A1/1.htm">电子商务</a>
                        <div>一、架构图那里搜网络爬虫框架主要针对电子商务网站进行数据爬取,分析,存储,索引。爬虫:爬虫负责爬取,解析,处理电子商务网站的网页的内容数据库:存储商品信息索引:商品的全文搜索索引Task队列:需要爬取的网页列表Visited表:已经爬取过的网页列表爬虫监控平台:web平台可以启动,停止爬虫,管理爬虫,task队列,visited表。二、爬虫1.流程1)Scheduler启动爬虫器,TaskMast</div>
                    </li>
                                <li><a href="/article/82.htm"
                                       title="java类加载顺序" target="_blank">java类加载顺序</a>
                                    <span class="text-muted">3213213333332132</span>
<a class="tag" taget="_blank" href="/search/java/1.htm">java</a>
                                    <div>package com.demo;

/**
 * @Description 类加载顺序
 * @author FuJianyong
 * 2015-2-6上午11:21:37
 */
public class ClassLoaderSequence {
	
	String s1 = "成员属性"; 
	
	static String s2 = "</div>
                                </li>
                                <li><a href="/article/209.htm"
                                       title="Hibernate与mybitas的比较" target="_blank">Hibernate与mybitas的比较</a>
                                    <span class="text-muted">BlueSkator</span>
<a class="tag" taget="_blank" href="/search/sql/1.htm">sql</a><a class="tag" taget="_blank" href="/search/Hibernate/1.htm">Hibernate</a><a class="tag" taget="_blank" href="/search/%E6%A1%86%E6%9E%B6/1.htm">框架</a><a class="tag" taget="_blank" href="/search/ibatis/1.htm">ibatis</a><a class="tag" taget="_blank" href="/search/orm/1.htm">orm</a>
                                    <div>第一章     Hibernate与MyBatis 
Hibernate 是当前最流行的O/R mapping框架,它出身于sf.net,现在已经成为Jboss的一部分。 Mybatis 是另外一种优秀的O/R mapping框架。目前属于apache的一个子项目。 
MyBatis 参考资料官网:http:</div>
                                </li>
                                <li><a href="/article/336.htm"
                                       title="php多维数组排序以及实际工作中的应用" target="_blank">php多维数组排序以及实际工作中的应用</a>
                                    <span class="text-muted">dcj3sjt126com</span>
<a class="tag" taget="_blank" href="/search/PHP/1.htm">PHP</a><a class="tag" taget="_blank" href="/search/usort/1.htm">usort</a><a class="tag" taget="_blank" href="/search/uasort/1.htm">uasort</a>
                                    <div>自定义排序函数返回false或负数意味着第一个参数应该排在第二个参数的前面, 正数或true反之, 0相等usort不保存键名uasort 键名会保存下来uksort 排序是对键名进行的 
<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8&q</div>
                                </li>
                                <li><a href="/article/463.htm"
                                       title="DOM改变字体大小" target="_blank">DOM改变字体大小</a>
                                    <span class="text-muted">周华华</span>
<a class="tag" taget="_blank" href="/search/%E5%89%8D%E7%AB%AF/1.htm">前端</a>
                                    <div><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml&q</div>
                                </li>
                                <li><a href="/article/590.htm"
                                       title="c3p0的配置" target="_blank">c3p0的配置</a>
                                    <span class="text-muted">g21121</span>
<a class="tag" taget="_blank" href="/search/c3p0/1.htm">c3p0</a>
                                    <div>c3p0是一个开源的JDBC连接池,它实现了数据源和JNDI绑定,支持JDBC3规范和JDBC2的标准扩展。c3p0的下载地址是:http://sourceforge.net/projects/c3p0/这里可以下载到c3p0最新版本。 
以在spring中配置dataSource为例: 
<!-- spring加载资源文件 -->
<bean name="prope</div>
                                </li>
                                <li><a href="/article/717.htm"
                                       title="Java获取工程路径的几种方法" target="_blank">Java获取工程路径的几种方法</a>
                                    <span class="text-muted">510888780</span>
<a class="tag" taget="_blank" href="/search/java/1.htm">java</a>
                                    <div>第一种: 
File f = new File(this.getClass().getResource("/").getPath()); 
System.out.println(f); 
结果: 
C:\Documents%20and%20Settings\Administrator\workspace\projectName\bin 
获取当前类的所在工程路径; 
如果不加“</div>
                                </li>
                                <li><a href="/article/844.htm"
                                       title="在类Unix系统下实现SSH免密码登录服务器" target="_blank">在类Unix系统下实现SSH免密码登录服务器</a>
                                    <span class="text-muted">Harry642</span>
<a class="tag" taget="_blank" href="/search/%E5%85%8D%E5%AF%86/1.htm">免密</a><a class="tag" taget="_blank" href="/search/ssh/1.htm">ssh</a>
                                    <div>1.客户机 
    (1)执行ssh-keygen -t rsa -C "xxxxx@xxxxx.com"生成公钥,xxx为自定义大email地址 
    (2)执行scp ~/.ssh/id_rsa.pub root@xxxxxxxxx:/tmp将公钥拷贝到服务器上,xxx为服务器地址 
    (3)执行cat</div>
                                </li>
                                <li><a href="/article/971.htm"
                                       title="Java新手入门的30个基本概念一" target="_blank">Java新手入门的30个基本概念一</a>
                                    <span class="text-muted">aijuans</span>
<a class="tag" taget="_blank" href="/search/java/1.htm">java</a><a class="tag" taget="_blank" href="/search/java+%E5%85%A5%E9%97%A8/1.htm">java 入门</a><a class="tag" taget="_blank" href="/search/%E6%96%B0%E6%89%8B/1.htm">新手</a>
                                    <div>在我们学习Java的过程中,掌握其中的基本概念对我们的学习无论是J2SE,J2EE,J2ME都是很重要的,J2SE是Java的基础,所以有必要对其中的基本概念做以归纳,以便大家在以后的学习过程中更好的理解java的精髓,在此我总结了30条基本的概念。  Java概述:  目前Java主要应用于中间件的开发(middleware)---处理客户机于服务器之间的通信技术,早期的实践证明,Java不适合</div>
                                </li>
                                <li><a href="/article/1098.htm"
                                       title="Memcached for windows 简单介绍" target="_blank">Memcached for windows 简单介绍</a>
                                    <span class="text-muted">antlove</span>
<a class="tag" taget="_blank" href="/search/java/1.htm">java</a><a class="tag" taget="_blank" href="/search/Web/1.htm">Web</a><a class="tag" taget="_blank" href="/search/windows/1.htm">windows</a><a class="tag" taget="_blank" href="/search/cache/1.htm">cache</a><a class="tag" taget="_blank" href="/search/memcached/1.htm">memcached</a>
                                    <div>1. 安装memcached server 
a. 下载memcached-1.2.6-win32-bin.zip 
b. 解压缩,dos 窗口切换到 memcached.exe所在目录,运行memcached.exe -d install 
c.启动memcached Server,直接在dos窗口键入 net start "memcached Server&quo</div>
                                </li>
                                <li><a href="/article/1225.htm"
                                       title="数据库对象的视图和索引" target="_blank">数据库对象的视图和索引</a>
                                    <span class="text-muted">百合不是茶</span>
<a class="tag" taget="_blank" href="/search/%E7%B4%A2%E5%BC%95/1.htm">索引</a><a class="tag" taget="_blank" href="/search/oeacle%E6%95%B0%E6%8D%AE%E5%BA%93/1.htm">oeacle数据库</a><a class="tag" taget="_blank" href="/search/%E8%A7%86%E5%9B%BE/1.htm">视图</a>
                                    <div>  
视图 
  
  视图是从一个表或视图导出的表,也可以是从多个表或视图导出的表。视图是一个虚表,数据库不对视图所对应的数据进行实际存储,只存储视图的定义,对视图的数据进行操作时,只能将字段定义为视图,不能将具体的数据定义为视图 
  
    为什么oracle需要视图; 
   &</div>
                                </li>
                                <li><a href="/article/1352.htm"
                                       title="Mockito(一) --入门篇" target="_blank">Mockito(一) --入门篇</a>
                                    <span class="text-muted">bijian1013</span>
<a class="tag" taget="_blank" href="/search/%E6%8C%81%E7%BB%AD%E9%9B%86%E6%88%90/1.htm">持续集成</a><a class="tag" taget="_blank" href="/search/mockito/1.htm">mockito</a><a class="tag" taget="_blank" href="/search/%E5%8D%95%E5%85%83%E6%B5%8B%E8%AF%95/1.htm">单元测试</a>
                                    <div>        Mockito是一个针对Java的mocking框架,它与EasyMock和jMock很相似,但是通过在执行后校验什么已经被调用,它消除了对期望 行为(expectations)的需要。其它的mocking库需要你在执行前记录期望行为(expectations),而这导致了丑陋的初始化代码。 
 &nb</div>
                                </li>
                                <li><a href="/article/1479.htm"
                                       title="精通Oracle10编程SQL(5)SQL函数" target="_blank">精通Oracle10编程SQL(5)SQL函数</a>
                                    <span class="text-muted">bijian1013</span>
<a class="tag" taget="_blank" href="/search/oracle/1.htm">oracle</a><a class="tag" taget="_blank" href="/search/%E6%95%B0%E6%8D%AE%E5%BA%93/1.htm">数据库</a><a class="tag" taget="_blank" href="/search/plsql/1.htm">plsql</a>
                                    <div>/*
 * SQL函数
*/

--数字函数
--ABS(n):返回数字n的绝对值
declare
  v_abs number(6,2);
begin
  v_abs:=abs(&no);
  dbms_output.put_line('绝对值:'||v_abs);
end;

--ACOS(n):返回数字n的反余弦值,输入值的范围是-1~1,输出值的单位为弧度</div>
                                </li>
                                <li><a href="/article/1606.htm"
                                       title="【Log4j一】Log4j总体介绍" target="_blank">【Log4j一】Log4j总体介绍</a>
                                    <span class="text-muted">bit1129</span>
<a class="tag" taget="_blank" href="/search/log4j/1.htm">log4j</a>
                                    <div>Log4j组件:Logger、Appender、Layout 
  
Log4j核心包含三个组件:logger、appender和layout。这三个组件协作提供日志功能: 
 
 日志的输出目标 
 日志的输出格式 
  日志的输出级别(是否抑制日志的输出) 
  logger继承特性 
A logger is said to be an ancestor of anothe</div>
                                </li>
                                <li><a href="/article/1733.htm"
                                       title="Java IO笔记" target="_blank">Java IO笔记</a>
                                    <span class="text-muted">白糖_</span>
<a class="tag" taget="_blank" href="/search/java/1.htm">java</a>
                                    <div>	public static void main(String[] args) throws IOException {
		//输入流
		InputStream in = Test.class.getResourceAsStream("/test");
		InputStreamReader isr = new InputStreamReader(in);
		Bu</div>
                                </li>
                                <li><a href="/article/1860.htm"
                                       title="Docker 监控" target="_blank">Docker 监控</a>
                                    <span class="text-muted">ronin47</span>
<a class="tag" taget="_blank" href="/search/docker%E7%9B%91%E6%8E%A7/1.htm">docker监控</a>
                                    <div>         
目前项目内部署了docker,于是涉及到关于监控的事情,参考一些经典实例以及一些自己的想法,总结一下思路。 1、关于监控的内容 监控宿主机本身 
监控宿主机本身还是比较简单的,同其他服务器监控类似,对cpu、network、io、disk等做通用的检查,这里不再细说。 
额外的,因为是docker的</div>
                                </li>
                                <li><a href="/article/1987.htm"
                                       title="java-顺时针打印图形" target="_blank">java-顺时针打印图形</a>
                                    <span class="text-muted">bylijinnan</span>
<a class="tag" taget="_blank" href="/search/java/1.htm">java</a>
                                    <div>一个画图程序 要求打印出: 
 

1.int i=5;   
2.1  2  3  4  5  
3.16 17 18 19 6  
4.15 24 25 20 7  
5.14 23 22 21 8  
6.13 12 11 10 9  
7.  
8.int i=6  
9.1  2  3  4  5   6  
10.20 21 22 23 24  7  
11.19</div>
                                </li>
                                <li><a href="/article/2114.htm"
                                       title="关于iReport汉化版强制使用英文的配置方法" target="_blank">关于iReport汉化版强制使用英文的配置方法</a>
                                    <span class="text-muted">Kai_Ge</span>
<a class="tag" taget="_blank" href="/search/iReport%E6%B1%89%E5%8C%96/1.htm">iReport汉化</a><a class="tag" taget="_blank" href="/search/%E8%8B%B1%E6%96%87%E7%89%88/1.htm">英文版</a>
                                    <div>对于那些具有强迫症的工程师来说,软件汉化固然好用,但是汉化不完整却极为头疼,本方法针对iReport汉化不完整的情况,强制使用英文版,方法如下: 
在 iReport 安装路径下的 etc/ireport.conf 里增加红色部分启动参数,即可变为英文版。   
# ${HOME} will be replaced by user home directory accordin</div>
                                </li>
                                <li><a href="/article/2241.htm"
                                       title="[并行计算]论宇宙的可计算性" target="_blank">[并行计算]论宇宙的可计算性</a>
                                    <span class="text-muted">comsci</span>
<a class="tag" taget="_blank" href="/search/%E5%B9%B6%E8%A1%8C%E8%AE%A1%E7%AE%97/1.htm">并行计算</a>
                                    <div> 
 
      现在我们知道,一个涡旋系统具有并行计算能力.按照自然运动理论,这个系统也同时具有存储能力,同时具备计算和存储能力的系统,在某种条件下一般都会产生意识...... 
 
      那么,这种概念让我们推论出一个结论 
 
 
    &nb</div>
                                </li>
                                <li><a href="/article/2368.htm"
                                       title="用OpenGL实现无限循环的coverflow" target="_blank">用OpenGL实现无限循环的coverflow</a>
                                    <span class="text-muted">dai_lm</span>
<a class="tag" taget="_blank" href="/search/android/1.htm">android</a><a class="tag" taget="_blank" href="/search/coverflow/1.htm">coverflow</a>
                                    <div>网上找了很久,都是用Gallery实现的,效果不是很满意,结果发现这个用OpenGL实现的,稍微修改了一下源码,实现了无限循环功能 
 
源码地址: 
https://github.com/jackfengji/glcoverflow 
 
 

public class CoverFlowOpenGL extends GLSurfaceView implements
		GLSurfaceV</div>
                                </li>
                                <li><a href="/article/2495.htm"
                                       title="JAVA数据计算的几个解决方案1" target="_blank">JAVA数据计算的几个解决方案1</a>
                                    <span class="text-muted">datamachine</span>
<a class="tag" taget="_blank" href="/search/java/1.htm">java</a><a class="tag" taget="_blank" href="/search/Hibernate/1.htm">Hibernate</a><a class="tag" taget="_blank" href="/search/%E8%AE%A1%E7%AE%97/1.htm">计算</a>
                                    <div>老大丢过来的软件跑了10天,摸到点门道,正好跟以前攒的私房有关联,整理存档。 
 
-----------------------------华丽的分割线------------------------------------- 
 
    数据计算层是指介于数据存储和应用程序之间,负责计算数据存储层的数据,并将计算结果返回应用程序的层次。J 
 &nbs</div>
                                </li>
                                <li><a href="/article/2622.htm"
                                       title="简单的用户授权系统,利用给user表添加一个字段标识管理员的方式" target="_blank">简单的用户授权系统,利用给user表添加一个字段标识管理员的方式</a>
                                    <span class="text-muted">dcj3sjt126com</span>
<a class="tag" taget="_blank" href="/search/yii/1.htm">yii</a>
                                    <div>怎么创建一个简单的(非 RBAC)用户授权系统 
通过查看论坛,我发现这是一个常见的问题,所以我决定写这篇文章。 
本文只包括授权系统.假设你已经知道怎么创建身份验证系统(登录)。 数据库 
首先在 user 表创建一个新的字段(integer 类型),字段名 'accessLevel',它定义了用户的访问权限 扩展 CWebUser 类 
在配置文件(一般为 protecte</div>
                                </li>
                                <li><a href="/article/2749.htm"
                                       title="未选之路" target="_blank">未选之路</a>
                                    <span class="text-muted">dcj3sjt126com</span>
<a class="tag" taget="_blank" href="/search/%E8%AF%97/1.htm">诗</a>
                                    <div>作者:罗伯特*费罗斯特 
  
黄色的树林里分出两条路, 
可惜我不能同时去涉足, 
我在那路口久久伫立, 
我向着一条路极目望去, 
直到它消失在丛林深处. 
  
但我却选了另外一条路, 
它荒草萋萋,十分幽寂; 
显得更诱人,更美丽, 
虽然在这两条小路上, 
都很少留下旅人的足迹. 
  
那天清晨落叶满地, 
两条路都未见脚印痕迹. 
呵,留下一条路等改日再</div>
                                </li>
                                <li><a href="/article/2876.htm"
                                       title="Java处理15位身份证变18位" target="_blank">Java处理15位身份证变18位</a>
                                    <span class="text-muted">蕃薯耀</span>
<a class="tag" taget="_blank" href="/search/18%E4%BD%8D%E8%BA%AB%E4%BB%BD%E8%AF%81%E5%8F%9815%E4%BD%8D/1.htm">18位身份证变15位</a><a class="tag" taget="_blank" href="/search/15%E4%BD%8D%E8%BA%AB%E4%BB%BD%E8%AF%81%E5%8F%9818%E4%BD%8D/1.htm">15位身份证变18位</a><a class="tag" taget="_blank" href="/search/%E8%BA%AB%E4%BB%BD%E8%AF%81%E8%BD%AC%E6%8D%A2/1.htm">身份证转换</a>
                                    <div>  
15位身份证变18位,18位身份证变15位 
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
蕃薯耀 201</div>
                                </li>
                                <li><a href="/article/3003.htm"
                                       title="SpringMVC4零配置--应用上下文配置【AppConfig】" target="_blank">SpringMVC4零配置--应用上下文配置【AppConfig】</a>
                                    <span class="text-muted">hanqunfeng</span>
<a class="tag" taget="_blank" href="/search/springmvc4/1.htm">springmvc4</a>
                                    <div>从spring3.0开始,Spring将JavaConfig整合到核心模块,普通的POJO只需要标注@Configuration注解,就可以成为spring配置类,并通过在方法上标注@Bean注解的方式注入bean。 
  
Xml配置和Java类配置对比如下: 
applicationContext-AppConfig.xml 
  
<!-- 激活自动代理功能 参看:</div>
                                </li>
                                <li><a href="/article/3130.htm"
                                       title="Android中webview跟JAVASCRIPT中的交互" target="_blank">Android中webview跟JAVASCRIPT中的交互</a>
                                    <span class="text-muted">jackyrong</span>
<a class="tag" taget="_blank" href="/search/JavaScript/1.htm">JavaScript</a><a class="tag" taget="_blank" href="/search/html/1.htm">html</a><a class="tag" taget="_blank" href="/search/android/1.htm">android</a><a class="tag" taget="_blank" href="/search/%E8%84%9A%E6%9C%AC/1.htm">脚本</a>
                                    <div>  在android的应用程序中,可以直接调用webview中的javascript代码,而webview中的javascript代码,也可以去调用ANDROID应用程序(也就是JAVA部分的代码).下面举例说明之: 
 
1 JAVASCRIPT脚本调用android程序 
   要在webview中,调用addJavascriptInterface(OBJ,int</div>
                                </li>
                                <li><a href="/article/3257.htm"
                                       title="8个最佳Web开发资源推荐" target="_blank">8个最佳Web开发资源推荐</a>
                                    <span class="text-muted">lampcy</span>
<a class="tag" taget="_blank" href="/search/%E7%BC%96%E7%A8%8B/1.htm">编程</a><a class="tag" taget="_blank" href="/search/Web/1.htm">Web</a><a class="tag" taget="_blank" href="/search/%E7%A8%8B%E5%BA%8F%E5%91%98/1.htm">程序员</a>
                                    <div>Web开发对程序员来说是一项较为复杂的工作,程序员需要快速地满足用户需求。如今很多的在线资源可以给程序员提供帮助,比如指导手册、在线课程和一些参考资料,而且这些资源基本都是免费和适合初学者的。无论你是需要选择一门新的编程语言,或是了解最新的标准,还是需要从其他地方找到一些灵感,我们这里为你整理了一些很好的Web开发资源,帮助你更成功地进行Web开发。 
这里列出10个最佳Web开发资源,它们都是受</div>
                                </li>
                                <li><a href="/article/3384.htm"
                                       title="架构师之面试------jdk的hashMap实现" target="_blank">架构师之面试------jdk的hashMap实现</a>
                                    <span class="text-muted">nannan408</span>
<a class="tag" taget="_blank" href="/search/HashMap/1.htm">HashMap</a>
                                    <div>1.前言。 
  如题。 
2.详述。 
  (1)hashMap算法就是数组链表。数组存放的元素是键值对。jdk通过移位算法(其实也就是简单的加乘算法),如下代码来生成数组下标(生成后indexFor一下就成下标了)。 
 

static int hash(int h) 
{ 
    h ^= (h >>> 20) ^ (h >>></div>
                                </li>
                                <li><a href="/article/3511.htm"
                                       title="html禁止清除input文本输入缓存" target="_blank">html禁止清除input文本输入缓存</a>
                                    <span class="text-muted">Rainbow702</span>
<a class="tag" taget="_blank" href="/search/html/1.htm">html</a><a class="tag" taget="_blank" href="/search/%E7%BC%93%E5%AD%98/1.htm">缓存</a><a class="tag" taget="_blank" href="/search/input/1.htm">input</a><a class="tag" taget="_blank" href="/search/%E8%BE%93%E5%85%A5%E6%A1%86/1.htm">输入框</a><a class="tag" taget="_blank" href="/search/change/1.htm">change</a>
                                    <div>多数浏览器默认会缓存input的值,只有使用ctl+F5强制刷新的才可以清除缓存记录。    
如果不想让浏览器缓存input的值,有2种方法: 
方法一: 在不想使用缓存的input中添加 autocomplete="off";  
<input type="text" autocomplete="off" n</div>
                                </li>
                                <li><a href="/article/3638.htm"
                                       title="POJO和JavaBean的区别和联系" target="_blank">POJO和JavaBean的区别和联系</a>
                                    <span class="text-muted">tjmljw</span>
<a class="tag" taget="_blank" href="/search/POJO/1.htm">POJO</a><a class="tag" taget="_blank" href="/search/java+beans/1.htm">java beans</a>
                                    <div>POJO 和JavaBean是我们常见的两个关键字,一般容易混淆,POJO全称是Plain Ordinary Java Object / Pure Old Java Object,中文可以翻译成:普通Java类,具有一部分getter/setter方法的那种类就可以称作POJO,但是JavaBean则比 POJO复杂很多, Java Bean 是可复用的组件,对 Java Bean 并没有严格的规</div>
                                </li>
                                <li><a href="/article/3765.htm"
                                       title="java中单例的五种写法" target="_blank">java中单例的五种写法</a>
                                    <span class="text-muted">liuxiaoling</span>
<a class="tag" taget="_blank" href="/search/java/1.htm">java</a><a class="tag" taget="_blank" href="/search/%E5%8D%95%E4%BE%8B/1.htm">单例</a>
                                    <div>/**
 * 单例模式的五种写法:
 * 1、懒汉
 * 2、恶汉
 * 3、静态内部类
 * 4、枚举
 * 5、双重校验锁
 */
/**
 * 五、 双重校验锁,在当前的内存模型中无效
 */
class LockSingleton
{

    private volatile static LockSingleton singleton;

    pri</div>
                                </li>
                </ul>
            </div>
        </div>
    </div>

<div>
    <div class="container">
        <div class="indexes">
            <strong>按字母分类:</strong>
            <a href="/tags/A/1.htm" target="_blank">A</a><a href="/tags/B/1.htm" target="_blank">B</a><a href="/tags/C/1.htm" target="_blank">C</a><a
                href="/tags/D/1.htm" target="_blank">D</a><a href="/tags/E/1.htm" target="_blank">E</a><a href="/tags/F/1.htm" target="_blank">F</a><a
                href="/tags/G/1.htm" target="_blank">G</a><a href="/tags/H/1.htm" target="_blank">H</a><a href="/tags/I/1.htm" target="_blank">I</a><a
                href="/tags/J/1.htm" target="_blank">J</a><a href="/tags/K/1.htm" target="_blank">K</a><a href="/tags/L/1.htm" target="_blank">L</a><a
                href="/tags/M/1.htm" target="_blank">M</a><a href="/tags/N/1.htm" target="_blank">N</a><a href="/tags/O/1.htm" target="_blank">O</a><a
                href="/tags/P/1.htm" target="_blank">P</a><a href="/tags/Q/1.htm" target="_blank">Q</a><a href="/tags/R/1.htm" target="_blank">R</a><a
                href="/tags/S/1.htm" target="_blank">S</a><a href="/tags/T/1.htm" target="_blank">T</a><a href="/tags/U/1.htm" target="_blank">U</a><a
                href="/tags/V/1.htm" target="_blank">V</a><a href="/tags/W/1.htm" target="_blank">W</a><a href="/tags/X/1.htm" target="_blank">X</a><a
                href="/tags/Y/1.htm" target="_blank">Y</a><a href="/tags/Z/1.htm" target="_blank">Z</a><a href="/tags/0/1.htm" target="_blank">其他</a>
        </div>
    </div>
</div>
<footer id="footer" class="mb30 mt30">
    <div class="container">
        <div class="footBglm">
            <a target="_blank" href="/">首页</a> -
            <a target="_blank" href="/custom/about.htm">关于我们</a> -
            <a target="_blank" href="/search/Java/1.htm">站内搜索</a> -
            <a target="_blank" href="/sitemap.txt">Sitemap</a> -
            <a target="_blank" href="/custom/delete.htm">侵权投诉</a>
        </div>
        <div class="copyright">版权所有 IT知识库 CopyRight © 2000-2050 E-COM-NET.COM , All Rights Reserved.
<!--            <a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank">京ICP备09083238号</a><br>-->
        </div>
    </div>
</footer>
<!-- 代码高亮 -->
<script type="text/javascript" src="/static/syntaxhighlighter/scripts/shCore.js"></script>
<script type="text/javascript" src="/static/syntaxhighlighter/scripts/shLegacy.js"></script>
<script type="text/javascript" src="/static/syntaxhighlighter/scripts/shAutoloader.js"></script>
<link type="text/css" rel="stylesheet" href="/static/syntaxhighlighter/styles/shCoreDefault.css"/>
<script type="text/javascript" src="/static/syntaxhighlighter/src/my_start_1.js"></script>





</body>

</html>