一、内核网络名称空间

  1、可通过ip netns进行操作

[root@localhost /]# ip netns help
Usage: ip netns list
ip netns add NAME
ip netns set NAME NETNSID
ip [-all] netns delete [NAME]
ip netns identify [PID]
ip netns pids NAME
ip [-all] netns exec [NAME] cmd ...
ip netns monitor
ip netns list-id

  2、启动各种网络类型的容器

    a、启动一个网络类型为bridge的容器并且在退出后自动删除(即能够对外通信的容器)。

[root@localhost ~]# docker run --name t1 -it --network bridge --rm busybox:latest
/ # ifconfig
eth0 Link encap:Ethernet HWaddr ::AC:::
inet addr:172.17.0.4 Bcast:172.17.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU: Metric:
RX packets: errors: dropped: overruns: frame:
TX packets: errors: dropped: overruns: carrier:
collisions: txqueuelen:
RX bytes: (508.0 B) TX bytes: (0.0 B) lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU: Metric:
RX packets: errors: dropped: overruns: frame:
TX packets: errors: dropped: overruns: carrier:
collisions: txqueuelen:
RX bytes: (0.0 B) TX bytes: (0.0 B)

    b、启动一个网络类型为none的容器并且在退出后自动删除(即封闭式容器)

[root@localhost ~]# docker run --name t1 -it --network none --rm busybox:latest
/ # ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU: Metric:
RX packets: errors: dropped: overruns: frame:
TX packets: errors: dropped: overruns: carrier:
collisions: txqueuelen:
RX bytes: (0.0 B) TX bytes: (0.0 B) / # exit

    c、容器默认的主机名就是其id,也可以在启动的时候给上主机名

[root@localhost ~]# docker run --name t1 -it --network bridge -h wohaoshuai --rm busybox:latest
/ # hostname
wohaoshuai

    d、容器默认的dns是宿主机的dns,可以在启动的时候给上其dns

[root@localhost ~]# docker run --name t1 -it --network bridge -h wohaoshuai --dns 114.114.114.114 --rm busybox:latest
/ # cat /etc/hosts
127.0.0.1 localhost
:: localhost ip6-localhost ip6-loopback
fe00:: ip6-localnet
ff00:: ip6-mcastprefix
ff02:: ip6-allnodes
ff02:: ip6-allrouters
172.17.0.4 wohaoshuai
/ # cat /etc/resolv.conf
nameserver 114.114.114.114

    e、可以给主机添加主机解析记录

[root@localhost ~]# docker run --name t1 -it --network bridge -h wohaoshuai --dns 114.114.114.114 --add-host www.wohaoshuai.com:192.168.11.11 --rm busybox:latest
/ # cat /etc/hosts
127.0.0.1 localhost
:: localhost ip6-localhost ip6-loopback
fe00:: ip6-localnet
ff00:: ip6-mcastprefix
ff02:: ip6-allnodes
ff02:: ip6-allrouters
192.168.11.11 www.wohaoshuai.com
172.17.0.4 wohaoshuai

  3、端口映射 -p

   

    a、将指定的容器端口映射至主机所有地址的一个动态端口

[root@localhost ~]# docker run -it -p  --rm --name webtest1 httpd
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.4. Set the 'ServerName' directive globally to suppress this message
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.4. Set the 'ServerName' directive globally to suppress this message
[Sat Apr ::16.001251 ] [mpm_event:notice] [pid :tid ] AH00489: Apache/2.4. (Unix) configured -- resuming normal operations
[Sat Apr ::16.001475 ] [core:notice] [pid :tid ] AH00094: Command line: 'httpd -D FOREGROUND'
192.168.10.1 - - [/Apr/::: +] "GET / HTTP/1.1"
192.168.10.1 - - [/Apr/::: +] "GET /favicon.ico HTTP/1.1"

另开一个shell查看:
[root@localhost ~]# docker port webtest1
/tcp -> 0.0.0.0:

    b、将容器端口映射至指定的主机端口

[root@localhost ~]# docker run -it --rm  -p : --name webtest1 httpd
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.4. Set the 'ServerName' directive globally to suppress this message
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.4. Set the 'ServerName' directive globally to suppress this message
[Sat Apr ::43.973155 ] [mpm_event:notice] [pid :tid ] AH00489: Apache/2.4. (Unix) configured -- resuming normal operations
[Sat Apr ::43.973377 ] [core:notice] [pid :tid ] AH00094: Command line: 'httpd -D FOREGROUND' 另起一个shell查看:
[root@localhost ~]# docker port webtest1
/tcp -> 0.0.0.0:

    c、将指定的容器端口映射至主机指定ip的动态端口

[root@localhost ~]# docker run -it --rm  -p 192.168.10.46:: --name webtest1 httpd
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.4. Set the 'ServerName' directive globally to suppress this message
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.4. Set the 'ServerName' directive globally to suppress this message
[Sat Apr ::08.815379 ] [mpm_event:notice] [pid :tid ] AH00489: Apache/2.4. (Unix) configured -- resuming normal operations
[Sat Apr ::08.815558 ] [core:notice] [pid :tid ] AH00094: Command line: 'httpd -D FOREGROUND' 另开一个shell查看:
[root@localhost ~]# docker port webtest1
/tcp -> 192.168.10.46:

    d、将指定的容器端口映射至主机指定的ip 的端口

[root@localhost ~]# docker run -it --rm  -p 192.168.10.46:: --name webtest1 httpd
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.4. Set the 'ServerName' directive globally to suppress this message
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.4. Set the 'ServerName' directive globally to suppress this message
[Sat Apr ::47.699843 ] [mpm_event:notice] [pid :tid ] AH00489: Apache/2.4. (Unix) configured -- resuming normal operations
[Sat Apr ::47.699977 ] [core:notice] [pid :tid ] AH00094: Command line: 'httpd -D FOREGROUND'
192.168.10.1 - - [/Apr/::: +] "GET / HTTP/1.1"
192.168.10.1 - - [/Apr/::: +] "GET /favicon.ico HTTP/1.1" [root@localhost ~]# docker port webtest1
/tcp -> 192.168.10.46:

  4、暴露容器所有端口到宿主机 -P

  5、启动联盟式容器

    a、启动容器1

[root@localhost ~]# docker run -it --name b1 --rm busybox
/ # ifconfig
eth0 Link encap:Ethernet HWaddr ::AC:::
inet addr:172.17.0.4 Bcast:172.17.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU: Metric:
RX packets: errors: dropped: overruns: frame:
TX packets: errors: dropped: overruns: carrier:
collisions: txqueuelen:
RX bytes: (578.0 B) TX bytes: (0.0 B) lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU: Metric:
RX packets: errors: dropped: overruns: frame:
TX packets: errors: dropped: overruns: carrier:
collisions: txqueuelen:
RX bytes: (0.0 B) TX bytes: (0.0 B)

    b、启动容器2共享容器1的网络名称空间(但是文件系统不是共享的)

[root@localhost ~]# docker run -it --name b2 --network container:b1 --rm busybox
/ # ifconfig
eth0 Link encap:Ethernet HWaddr ::AC:::
inet addr:172.17.0.4 Bcast:172.17.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU: Metric:
RX packets: errors: dropped: overruns: frame:
TX packets: errors: dropped: overruns: carrier:
collisions: txqueuelen:
RX bytes: (648.0 B) TX bytes: (0.0 B) lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU: Metric:
RX packets: errors: dropped: overruns: frame:
TX packets: errors: dropped: overruns: carrier:
collisions: txqueuelen:
RX bytes: (0.0 B) TX bytes: (0.0 B)

    c、在容器1上启动一个httpd服务

/ # mkdir /tmp/httptest
/ # echo "http test" >> /tmp/httptest/index.html
/ # httpd -h /tmp/httptest/
/ # netstat -anpt
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 :::80 :::* LISTEN 9/httpd
tcp 0 0 ::ffff:127.0.0.1:80 ::ffff:127.0.0.1:33282 TIME_WAIT -

    d、在容器2上查看

/ # wget -O - -q 127.0.0.1
http test
/ # netstat -anpt
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp ::: :::* LISTEN -

  6、共享主机网络空间

    a、启动容器2,共享主机网络空间

[root@localhost ~]# docker run -it --name b2 --network host --rm busybox
/ # ifconfig
docker0 Link encap:Ethernet HWaddr :::6B::
inet addr:172.17.0.1 Bcast:172.17.255.255 Mask:255.255.0.0
inet6 addr: fe80:::7ff:fe6b:/ Scope:Link
UP BROADCAST RUNNING MULTICAST MTU: Metric:
RX packets: errors: dropped: overruns: frame:
TX packets: errors: dropped: overruns: carrier:
collisions: txqueuelen:
RX bytes: (2.9 KiB) TX bytes: (4.1 KiB) ens33 Link encap:Ethernet HWaddr :0C::A7:CE:
inet addr:192.168.10.46 Bcast:192.168.10.255 Mask:255.255.255.0
inet6 addr: fe80::2b2a:bd85:8d15:14c/ Scope:Link
UP BROADCAST RUNNING MULTICAST MTU: Metric:
RX packets: errors: dropped: overruns: frame:
TX packets: errors: dropped: overruns: carrier:
collisions: txqueuelen:
RX bytes: (51.6 MiB) TX bytes: (1.1 MiB) lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::/ Scope:Host
UP LOOPBACK RUNNING MTU: Metric:
RX packets: errors: dropped: overruns: frame:
TX packets: errors: dropped: overruns: carrier:
collisions: txqueuelen:
RX bytes: (5.1 KiB) TX bytes: (5.1 KiB) veth24abfad Link encap:Ethernet HWaddr ::2D:BA:ED:
inet6 addr: fe80:::2dff:feba:ed63/ Scope:Link
UP BROADCAST RUNNING MULTICAST MTU: Metric:
RX packets: errors: dropped: overruns: frame:
TX packets: errors: dropped: overruns: carrier:
collisions: txqueuelen:
RX bytes: (0.0 B) TX bytes: (1.5 KiB) veth34dd4fe Link encap:Ethernet HWaddr EA:F1:6D:7E:EB:
inet6 addr: fe80::e8f1:6dff:fe7e:eb23/ Scope:Link
UP BROADCAST RUNNING MULTICAST MTU: Metric:
RX packets: errors: dropped: overruns: frame:
TX packets: errors: dropped: overruns: carrier:
collisions: txqueuelen:
RX bytes: (0.0 B) TX bytes: (648.0 B) vetha7c5640 Link encap:Ethernet HWaddr CE:::9D:AE:0E
inet6 addr: fe80::cc76:19ff:fe9d:ae0e/ Scope:Link
UP BROADCAST RUNNING MULTICAST MTU: Metric:
RX packets: errors: dropped: overruns: frame:
TX packets: errors: dropped: overruns: carrier:
collisions: txqueuelen:
RX bytes: (0.0 B) TX bytes: (1.7 KiB)

    b、在容器中启动http服务,在宿主机中也可访问

/ # echo "hello wohaoshuai" > /tmp/index.html
/ # httpd -h /tmp/
/ #
/ #
/ #
/ # netstat -anpt
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0.0.0.0: 0.0.0.0:* LISTEN -
tcp 0.0.0.0: 0.0.0.0:* LISTEN -
tcp 127.0.0.1: 0.0.0.0:* LISTEN -
tcp 192.168.10.46: 192.168.10.1: ESTABLISHED -
tcp 192.168.10.46: 192.168.10.1: ESTABLISHED -
tcp ::: :::* LISTEN -
tcp ::: :::* LISTEN /httpd
tcp ::: :::* LISTEN -
tcp ::: :::* LISTEN -

二、修改docker 默认项

  1、自定义docker网络属性

    

[root@localhost ~]# more /etc/docker/daemon.json
{
"registry-mirrors": ["https://guxaj7v7.mirror.aliyuncs.com","https://registry.docker-cn.com"],
"bip": "10.0.0.1/16"
}
[root@localhost ~]# ip addr
: lo: <LOOPBACK,UP,LOWER_UP> mtu qdisc noqueue state UNKNOWN group default qlen
link/loopback ::::: brd :::::
inet 127.0.0.1/ scope host lo
valid_lft forever preferred_lft forever
inet6 ::/ scope host
valid_lft forever preferred_lft forever
: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu qdisc pfifo_fast state UP group default qlen
link/ether :0c::a7:ce: brd ff:ff:ff:ff:ff:ff
inet 192.168.10.46/ brd 192.168.10.255 scope global noprefixroute ens33
valid_lft forever preferred_lft forever
inet6 fe80::2b2a:bd85:8d15:14c/ scope link noprefixroute
valid_lft forever preferred_lft forever
: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu qdisc noqueue state DOWN group default
link/ether :::6b:: brd ff:ff:ff:ff:ff:ff
inet 10.0.0.1/ brd 10.0.255.255 scope global docker0
valid_lft forever preferred_lft forever
inet6 fe80:::7ff:fe6b:/ scope link
valid_lft forever preferred_lft forever

  2、修改docker 监听方式

    a、方式1

    b、方式2:不同版本docker修改方式不一样,另一种修改方式如下:

      vim /usr/lib/systemd/system/docker.service

      在[service]下加如下参数

[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock

      重启docker 服务

[root@localhost ~]# systemctl daemon-reload
[root@localhost ~]# systemctl restart docker
[root@localhost ~]# netstat -anpt
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0.0.0.0: 0.0.0.0:* LISTEN /rpcbind
tcp 0.0.0.0: 0.0.0.0:* LISTEN /sshd
tcp 127.0.0.1: 0.0.0.0:* LISTEN /master
tcp 192.168.10.46: 192.168.10.1: ESTABLISHED /sshd: root@pts
tcp 192.168.10.46: 192.168.10.1: ESTABLISHED /sshd: root@pts
tcp6 ::: :::* LISTEN /dockerd
tcp6 ::: :::* LISTEN /rpcbind
tcp6 ::: :::* LISTEN /sshd
tcp6 ::: :::* LISTEN /master
[root@localhost ~]# ls /var/run/
abrt cron.reboot docker.sock lock mod_fcgid rpcbind.lock syslogd.pid utmp
atd.pid dbus ebtables.lock log mount rpcbind.sock systemd vmware
auditd.pid dmeventd-client faillock lsm netreport sepermit tmpfiles.d xtables.lock
console dmeventd-server firewalld lvm NetworkManager setrans tuned
containerd docker httpd lvmetad.pid plymouth sshd.pid udev
crond.pid docker.pid initramfs mdadm rpcbind sudo user

    c、访问

[root@localhost ~]# docker -H 192.168.10.46 ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@localhost ~]# docker -H 192.168.10.46 images
REPOSITORY TAG IMAGE ID CREATED SIZE
httpd latest d4a07e6ce470 days ago 132MB
busybox latest af2f74c517aa days ago .2MB
centos latest 9f38484d220f weeks ago 202MB

三、不同网络之间容器互相访问

  1、创建网络

[root@localhost ~]# docker network create -d bridge --subnet "172.16.0.0/16" --gateway "172.16.0.1" mybr0
fceba8db97014f8f762b48cced3399ecb539b4510f68181df992997d67ae1307
[root@localhost ~]# docker network ls
NETWORK ID NAME DRIVER SCOPE
0479ba9d5a7c bridge bridge local
1f98da302a92 host host local
fceba8db9701 mybr0 bridge local
bdb9eff6069c none null local
[root@localhost ~]# ip addr
: lo: <LOOPBACK,UP,LOWER_UP> mtu qdisc noqueue state UNKNOWN group default qlen
link/loopback ::::: brd :::::
inet 127.0.0.1/ scope host lo
valid_lft forever preferred_lft forever
inet6 ::/ scope host
valid_lft forever preferred_lft forever
: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu qdisc pfifo_fast state UP group default qlen
link/ether :0c::a7:ce: brd ff:ff:ff:ff:ff:ff
inet 192.168.10.46/ brd 192.168.10.255 scope global noprefixroute ens33
valid_lft forever preferred_lft forever
inet6 fe80::2b2a:bd85:8d15:14c/ scope link noprefixroute
valid_lft forever preferred_lft forever
: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu qdisc noqueue state DOWN group default
link/ether :::6b:: brd ff:ff:ff:ff:ff:ff
inet 10.0.0.1/ brd 10.0.255.255 scope global docker0
valid_lft forever preferred_lft forever
inet6 fe80:::7ff:fe6b:/ scope link
valid_lft forever preferred_lft forever
: br-fceba8db9701: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu qdisc noqueue state DOWN group default
link/ether ::7d::e3:a0 brd ff:ff:ff:ff:ff:ff
inet 172.16.0.1/ brd 172.16.255.255 scope global br-fceba8db9701
valid_lft forever preferred_lft forever

  2、创建容器1并加入到刚刚创建的网络中

[root@localhost ~]# docker run --name t1 -it --network mybr0 busybox:latest
/ # ifconfig
eth0 Link encap:Ethernet HWaddr ::AC:::
inet addr:172.16.0.2 Bcast:172.16.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU: Metric:
RX packets: errors: dropped: overruns: frame:
TX packets: errors: dropped: overruns: carrier:
collisions: txqueuelen:
RX bytes: (1.2 KiB) TX bytes: (0.0 B) lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU: Metric:
RX packets: errors: dropped: overruns: frame:
TX packets: errors: dropped: overruns: carrier:
collisions: txqueuelen:
RX bytes: (0.0 B) TX bytes: (0.0 B)

  3、创建容器2并加入bridge网络

[root@localhost ~]# docker run --name t2 -it --network bridge busybox:latest
/ # ifconfig
eth0 Link encap:Ethernet HWaddr ::0A:::
inet addr:10.0.0.2 Bcast:10.0.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU: Metric:
RX packets: errors: dropped: overruns: frame:
TX packets: errors: dropped: overruns: carrier:
collisions: txqueuelen:
RX bytes: (508.0 B) TX bytes: (0.0 B) lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU: Metric:
RX packets: errors: dropped: overruns: frame:
TX packets: errors: dropped: overruns: carrier:
collisions: txqueuelen:
RX bytes: (0.0 B) TX bytes: (0.0 B)

  4、要想容器1能够访问到容器2则需要在宿主机上开启nat转发

    a、查看是否开启转发

[root@localhost ~]# cat /proc/sys/net/ipv4/ip_forward

    b、在iptables上将相应规则打开即可,因为iptables默认是阻止两个不同网络容器之间进行通信的。

Docker 学习5 Docker容器网络的更多相关文章

  1. Docker学习(六): 网络使用与配置

    特别声明: 博文主要是学习过程中的知识整理,以便之后的查阅回顾.部分内容来源于网络(如有摘录未标注请指出).内容如有差错,也欢迎指正! =============系列文章============= 1 ...

  2. Docker学习之Docker容器基本使用

    Docker学习之Docker容器基本使用 新建容器并启动 命令格式:docker run --options repository:tag 后台运行 命令格式:-d 已存在的容器相关操作 启动:do ...

  3. Docker学习之Docker镜像基本使用

    Docker学习之Docker镜像基本使用 获取镜像 命令格式:docker pull [选项] [Docker Registry 地址[:端口号]/]仓库名[:标签] 例如: docker pull ...

  4. Docker学习笔记 — Docker私有仓库搭建

    Docker学习笔记 — Docker私有仓库搭建   目录(?)[-] 环境准备 搭建私有仓库 测试 管理仓库中的镜像 查询 删除 Registry V2   和Mavan的管理一样,Dockers ...

  5. Docker的单主机容器网络

    作者:杨冬 欢迎转载,也请保留这段声明.谢谢! 出处: https://andyyoung01.github.io/ 或 http://andyyoung01.16mb.com/ 本篇文章主要探索Do ...

  6. Docker学习笔记 - Docker容器内部署redis

    Docker学习笔记(2-4)Docker应用实验-redist server 和client的安装使用 一.获取redis容器(含客户端和服务端) 二.创建服务端容器 1.在终端A中运行redis- ...

  7. Docker学习笔记 - Docker容器之间的连接

    学习目标: 容器之间可以相互连接访问:: --link redis:redisAlias 准备工作 FROM ubuntu:14.04 RUN apt-get install -y ping RUN  ...

  8. Docker学习笔记——制作容器与容器概念

    Docker能做些什么? 1.docker能够解决虚拟机能够解决的问题 2.隔离应用依赖 3.创建应用镜像并复制 4.创建容易分发的即启即用的应用 5.docker的想法是创建软件程序可移植的轻量容器 ...

  9. <Docker学习>6. docker使用网络

    在容器中部署一个web应用,外部如何访问? 容器与容器间如何访问? 外部访问容器 容器可以运行一些网络应用,让外部也可以访问的话,需要进行服务器和容器的端口映射 -p 或者 -P -P默认会分配一个4 ...

  10. DOCKER学习_004:Docker网络

    一 简介 当Docker进程启动时,会在主机上创建一个名为docker0的虚拟网桥,此主机上启动的docker容器会连接到这个虚拟网桥上.虚拟网桥的工作方式和物理交换机类似,这样主机上的所有容器就通过 ...

随机推荐

  1. 04--STL序列容器(Stack和Queue)

    总括: stack和queue不支持迭代 一:栈Stack (一)栈的简介 stack是堆栈容器,是一种“先进后出”的容器. stack是简单地装饰deque容器而成为另外的一种容器. (二)栈的默认 ...

  2. MongoDB分组查询,聚合查询,以及复杂查询

    准备数据 from pymongo import MongoClient import datetime client=MongoClient('mongodb://localhost:27017') ...

  3. ASP.NET MVC深入浅出系列

    一. ASP.NET体系 从事.Net开发以来,最先接触的Web开发框架是Asp.Net WebForm,该框架高度封装,为了隐藏Http的无状态模式,ViewState功不可没,通过的控件的拖拽和绑 ...

  4. docker学习------记录centos7.5下docker安装更换国内源的处理过程

    一.centos7.5下更换阿里源 1.装好centos7.5镜像,将yum源更换为阿里源 第一步:刚出的centos7.5是解析不到阿里的东西的,所以找了台centos7.4,下载一些包 (1) 下 ...

  5. HTTP常见的状态码——面试题常考

    一些常见的状态码为:  200 - 服务器成功返回网页 400(错误请求)服务器不理解请求的语法. 404 - 请求的网页不存在 500(服务器内部错误)服务器遇到错误,无法完成请求. 503 - 服 ...

  6. 《B2C商城》电商平台搭建流程分析

    商城网站建设在当今互联网时代中是非常重要的.商城网站,是企业产品展示.品牌宣传与消费者互动交流的一个平台,利用好这样的一个平台,就能占得先机.那么问题来了,商城网站如何建设呢?这对于企业来说真的是一个 ...

  7. js中函数和方法的区别

    函数(function)是一段代码,需要通过名字来进行调用.它能将一些数据(函数的参数)传递进去进行处理,然后返回一些数据(函数的返回值),也可以不返回数据. 方法(method)是通过对象调用的ja ...

  8. JavaWeb处理GET、POST时的编码乱码问题

    对于GET方法,只要设置了res.setContentType("text/html;charset=UTF-8"), req.getParameter()就不会产生乱码. 对于P ...

  9. mysql基础学习

    二.操作表 1.自行创建测试数据: -- 创建数据库create database practice charset utf8;-- 1.自行创建测试数据:---- 创建班级表:classcreate ...

  10. JAVA基础---入门

    JDK的安装和环境变量的配置: 在Oralce官网下载好符合自己电脑配置的JDK后开始配置环境变量. 找到下载好的JDK的位置,复制,然后在环境变量里创建“JAVA_HOME”,粘贴:在path里用“ ...