百度360必应搜狗淘宝本站头条
当前位置:网站首页 > 编程字典 > 正文

「Docker自学笔记」Docker常用命令&用法

toyiye 2024-06-30 09:41 13 浏览 0 评论

安装(Ubuntu)使用(常用命令)容器数据卷创建自定义镜像DockerFile容器内自定义镜像源自定义网络保存镜像导入镜像推送镜像到hub Docker常用命令

Docker常用命令

  • 官方下载安装
  • 官方文档
  • Docker仓库搜索

安装(Ubuntu)

  • 更多内容请查考官方文档
  • 依次执行下列代码即可!
#卸载旧版本
sudo apt-get remove docker docker-engine docker.io containerd runc

#使用 Docker 仓库进行安装
#更新 apt 包索引
sudo apt-get update

#安装 apt 依赖包,用于通过HTTPS来获取仓库
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg \
    lsb-release \
    software-properties-common
    
#添加Docker官方的GPG密钥(使用镜像)
 curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
 
#设置稳定版仓库
sudo add-apt-repository \
   "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/ \
  $(lsb_release -cs) \
  stable"
  
#安装 Docker 引擎
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
  • 测试是否安装成功
sudo docker run hello-world

xiaoqiang@xiaoqiangclub:~/桌面nbsp;sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b8dfde127a29: Already exists 
Digest: sha256:9f6ad537c5132bcce57f7a0a20e317228d382c3cd61edae14650eec68b2b345c
Status: Downloaded newer image for hello-world:latest

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

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

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

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

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

  • 更多内容请查考官方文档

使用(常用命令)

  • 下面是一些常用命令
#万能的帮助命令
docker 命令 --help   #docker images --help

#搜索镜像
docker search 镜像  #docker search ubuntu

#拉取镜像
docker pull 镜像:版本 #docker pull ubuntu:18.04

#查看本地所有镜像
docker images
docker images -aq  #显示所有镜像的id 

#删除镜像
docker rmi -f 镜像名/id  #-f强制删除镜像
docker rmi -f $(docker images -aq)  #删除所有镜像

#启动容器,可以使用 镜像名:版本号 启动,如果是最新版可以省略版本号;也可以使用 镜像id
docker run -i -t 镜像名:版本号 /bin/bash  
docker run -i -t id /bin/bash
docker run -it --rm id /bin/bash  #添加 --rm参数 可以实现在退出容器后就删除容器(一般用于测试)
参数说明:
-i: 交互式操作。
-t: 终端。
ubuntu: ubuntu 镜像。
/bin/bash:放在镜像名后的是命令,这里我们希望有个交互式 Shell,因此用的是 /bin/bash。
要退出终端,直接输入 exit 这个命令会停止容器!可以使用 ctrl + p + q 组合键退出,不会退出容器

#退出容器
exit      #这个命令会停止容器!
ctrl + p + q    #组合键退出,不会退出容器

#查看当前运行的容器
docker ps
docker ps -a     #显示所有容器
#启动一个已停止的容器
docker start 容器id #通过docker ps -a可以查看
#重启一个容器
docker restart 容器id 
#停止容器
docker stop 容器id
docker kill 容器id   #当使用 stop 无法正常停止的时候使用 kill

#后台运行容器:-d 后台运行 --name 设定容器的别名
docker run -i -t -d -p 外网端口:容器端口 --name 容器别名 镜像 /bin/bash  #docker run -i -t -d -p 6666:80 --name ubuntu-test ubuntu /bin/bash

#在使用 -d 参数时,容器启动后会进入后台,此时想要进入容器,可以通过以下指令进入
docker attach 容器id  #重新进入容器当前正在运行的命令终端,使用exit会停止容器!
docker exec -i -t 容器id /bin/bash #进入容器并开启一个新的终端,使用exit不会停止容器(常用)

#删除容器
docker rm -f 容器别名/容器id  #docker rm -f test_ubuntu

#拷贝容器文件到宿主机(复制文件)
docker cp 容器id/容器id:容器内文件路径 要拷贝到的路径  #docker cp test-ubuntu:/home/test.txt /home

#查看容器的cpu内存状态
docker stats

# 从容器创建一个新的镜像
docker commit -a 作者 -m 说明信息 容器id 容器名称:版本号 #docker commit -a "xiaoqiangclub" -m "this is a test!" a404c6c174a2  mymysql:v1 
OPTIONS说明:

-a :提交镜像的作者;

-c :使用Dockerfile指令来创建镜像;

-m :提交时的说明文字;

-p :在commit时,将容器暂停。
  • docker run -it --rm id /bin/bash 添加参数 --rm 可以实现在退出容器后就删除容器(一般用于测试)
  • 直接输入exit 这个命令会停止容器!可以使用ctrl + p + q 组合键退出,不会退出容器
  • 我们常用docker exec -i -t 容器id /bin/bash命令进入容器并开启一个新的终端,这个命令进入容器后使用exit不会停止容器
  • 后台启动容器使用docker run -i -t -d --name ubuntu-test ubuntu /bin/bash
  • 复制文件命令docker cp test-ubuntu:/home/test.txt /home
  • docker run -m设置容器使用内存最大值

容器数据卷

为了容器内数据的持久化&与宿主机的数据同步,我们可以使用容器的数据卷。

  • 添加-v参数来映射目录,命令docker run -it -v 主机目录:容器目录 镜像 /bin/bash
  • 具名挂载:- 添加-v参数来映射目录,命令docker run -it -v 卷名:主机目录:容器目录 镜像 /bin/bash;使用docker volume ls查看卷
docker 容器内路径    # 匿名挂载
docker 卷名:容器内路径   # 具名挂载
docker /宿主机路径:容器内路径 # 指定路径挂载
docker 卷名:容器内路径:ro/rw  # 使用ro/rw来设置读写权限:ro:readonly;rw:readwrite;默认为:rw;如果设置为ro:说明这个路径只能通过宿主机改变,容器内无法改变!
  • docker inspect获取容器/镜像的元数据(详情)

创建自定义镜像

  • 使用Docker commit 命令从容器创建一个新的镜像,下面是他的用法
xiaoqiang@xiaoqiangclub:~/studyArea/dockerStudynbsp;docker commit --help

Usage:  docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]] # 用法

Create a new image from a container's changes

Options:
  -a, --author string    作者(e.g., "John Hannibal Smith <hannibal@a-team.com>")
  -c, --change list      使用Dockerfile指令来创建镜像
  -m, --message string   提交时的说明文字
  -p, --pause            在commit时,将容器暂停 (默认:true)
  • 我们运行容器并且在容器中安装了ipython,现在使用commit来创建一个行的镜像
xiaoqiang@xiaoqiangclub:~/studyArea/dockerStudynbsp;docker commit -m 'add ipython' -a 'xiaoqiangclub<xiaoqiangclub@hotmail.com>' image-test image-commit-test
sha256:b6819ae4531e548c7ff400017d302da82601f931eed7c1edf765465556601d64
  • docker images查看镜像
xiaoqiang@xiaoqiangclub:~/studyArea/dockerStudynbsp;docker images
REPOSITORY          TAG       IMAGE ID       CREATED         SIZE
image-commit-test   latest    b6819ae4531e   2 minutes ago   234MB  # 这个就是我们安装ipython后新创建的镜像
my-ubuntu           latest    beb3e79259ee   10 hours ago    134MB

DockerFile

Dockerfile就是用来构建docker镜像的构建文件

  • DockerFile常用命令
FROM    # 基础镜像
MAINTAINER   # 作者,姓名 + 邮箱
RUN     # 镜像构建的时候需要运行的命令
ADD     # 添加内容(COPY文件,会自动解压)
WORKDIR    # 设置工作目录(相当于cd)
VOLUME    # 目录挂载
EXPOST    # 暴露端口
CMD     # 指定容器启动的时候需要运行的命令,只有最后一个会生效,可被替代!
ENTRYPOINT   # 指定容器启动的时候需要运行的命令,可以追加命令
ONBUILD    # 当构建一个被继承时,DockerFile 就会运行 ONBUILD 的指令,是一个触发指令。
COPY    # 类似ADD,将文件拷贝到镜像中
ENV     # 构建的时候设置环境变量

DockerFile常用命令

容器内自定义镜像源

  • 简单示例
xiaoqiang@xiaoqiangclub:~/桌面/docker-study/DockerFilenbsp;vim myDockFile-ubuntu
xiaoqiang@xiaoqiangclub:~/桌面/docker-study/DockerFilenbsp;cat myDockFile-ubuntu 
FROM ubuntu
MAINTAINER xiaoqiangclub<xiaoqiangclub@hotmail.com>

ENV MYPATH /usr/local
WORKDIR $MYPATH

# 设置镜像源
COPY sources.list /etc/apt/sources.list  
# 使用&&连接构建为一层,最后清理缓存
RUN apt update \
&&apt-get install -y vim net-tools \
&& rm -rf /var/lib/apt/lists/*

EXPOSE 80

CMD echo $MYPATH
CMD ECHO "----end----"
CMD /bin/bash
  • 报错解决方案
  • sources.list文件
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
  • 使用docker history 容器id/容器名:版本可以查看容器的构建过程
  • 容器内更换镜像源后使用apt update可能会提示以下错误(NO_PUBKEY缺少公钥):
  • 依次运行gpg --keyserver keyserver.ubuntu.com --recv 公钥gpg --export --armor 公钥 | apt-key add -即可(非docker容器中运行的话需要添加sudo
root@eee3e5c095f6:/# gpg --keyserver keyserver.ubuntu.com --recv 3B4FE6ACC0B21F32 # 报错的时候提供的公钥
gpg: directory '/root/.gnupg' created
gpg: keybox '/root/.gnupg/pubring.kbx' created
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key 3B4FE6ACC0B21F32: public key "Ubuntu Archive Automatic Signing Key (2012) <ftpmaster@ubuntu.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1
root@eee3e5c095f6:/# gpg --export --armor 3B4FE6ACC0B21F32 | apt-key add -
OK
  • 现在在运行apt update就正常了!
  • 使用build生成镜像,先看看参数说明
xiaoqiang@xiaoqiangclub:~/桌面/myProjects/myDockerFilenbsp;docker build --help

Usage:  docker build [OPTIONS] PATH | URL | -

Build an image from a Dockerfile

Options:
      --add-host list           Add a custom host-to-IP mapping (host:ip)
      --build-arg list          Set build-time variables
      --cache-from strings      Images to consider as cache sources
      --cgroup-parent string    Optional parent cgroup for the container
      --compress                Compress the build context using gzip
      --cpu-period int          Limit the CPU CFS (Completely Fair Scheduler) period
      --cpu-quota int           Limit the CPU CFS (Completely Fair Scheduler) quota
  -c, --cpu-shares int          CPU shares (relative weight)
      --cpuset-cpus string      CPUs in which to allow execution (0-3, 0,1)
      --cpuset-mems string      MEMs in which to allow execution (0-3, 0,1)
      --disable-content-trust   Skip image verification (default true)
  -f, --file string             Name of the Dockerfile (Default is 'PATH/Dockerfile')
      --force-rm                Always remove intermediate containers
      --iidfile string          Write the image ID to the file
      --isolation string        Container isolation technology
      --label list              Set metadata for an image
  -m, --memory bytes            Memory limit
      --memory-swap bytes       Swap limit equal to memory plus swap: '-1' to enable unlimited swap
      --network string          Set the networking mode for the RUN instructions during build (default "default")
      --no-cache                Do not use cache when building the image
      --pull                    Always attempt to pull a newer version of the image
  -q, --quiet                   Suppress the build output and print image ID on success
      --rm                      Remove intermediate containers after a successful build (default true)
      --security-opt strings    Security options
      --shm-size bytes          Size of /dev/shm
  -t, --tag list                Name and optionally a tag in the 'name:tag' format
      --target string           Set the target build stage to build.
      --ulimit ulimit           Ulimit options (default [])
  • 如果你的文件名为Dockerfile,可以直接使用docker build -t 镜像名:版本号 .(注意最后有一个点,如果是其他文件名,请使用-f参数指定文件路径)

自定义网络

  • 我们可以使用docker network自定义网络,使用说明
Usage:  docker network COMMAND

Manage networks

Commands:
  connect     # 将一个容器连接到网络
  create      # 创建一个自定义网络
  disconnect  # 将一个容器从自定义网络断开
  inspect     # 显示自定义网络的详细信息
  ls          # 列出所有网络
  prune       # 删除所有未使用的网络
  rm          # 删除一个或多个网络
  • 下面是docker默认的网络
xiaoqiang@xiaoqiangclub:~/studyArea/dockerStudynbsp;docker network ls
NETWORK ID     NAME                DRIVER    SCOPE
b3c47254c1ce   bridge              bridge    local
205f46f5b907   host                host      local
8d0210334194   none                null      local
  • 我们可以使用--net 网络的方式指定容器使用的网络,如docker run -it --net host my-ubuntu
  • 有时候在docker中使用Ubuntu镜像无法联网,我们可以尝试使用命令docker run -it --net host ubuntu即可解决!(有些情况下重启一下主机就解决了!)
  • 自己创建一个docker network create参数
xiaoqiang@xiaoqiangclub:~/studyArea/dockerStudynbsp;docker network create --help

Usage:  docker network create [OPTIONS] NETWORK

Create a network

Options:
      --attachable           Enable manual container attachment
      --aux-address map      Auxiliary IPv4 or IPv6 addresses used by Network driver (default map[])
      --config-from string   The network from which to copy the configuration
      --config-only          Create a configuration only network
  -d, --driver string        创建一个网络,默认:bridge
      --gateway strings      网关
      --ingress              Create swarm routing-mesh network
      --internal             Restrict external access to the network
      --ip-range strings     Allocate container ip from a sub-range
      --ipam-driver string   IP Address Management Driver (default "default")
      --ipam-opt map         Set IPAM driver specific options (default map[])
      --ipv6                 Enable IPv6 networking
      --label list           Set metadata on a network
  -o, --opt map              Set driver specific options (default map[])
      --scope string         Control the network's scope
      --subnet strings       子网掩码
  • --drive类型
bridge:多由于独立container之间的通信
host: 直接使用宿主机的网络,端口也使用宿主机的
overlay:当有多个docker主机时,跨主机的container通信
macvlan:每个container都有一个虚拟的MAC地址
none: 禁用网络
  • 根据上面的使用说明,我们可以尝试使用命令docker network create --driver bridge --subnet 192.168.0.0/16 --gateway 192.168.0.1 mynet来创建一个网络(也可以直接简写docker network create test-net):
xiaoqiang@xiaoqiangclub:~/studyArea/dockerStudynbsp;docker network create --driver bridge --subnet 192.168.0.0/16 --gateway 192.168.0.1 mynet
856ac8b90e9b76be642751446de170d6400b9a9c96f896f1ee71de8db7f4d8f0
  • 现在查看一下docker下的网络docker network ls
xiaoqiang@xiaoqiangclub:~/studyArea/dockerStudynbsp;docker network ls
NETWORK ID     NAME                DRIVER    SCOPE
2087a9b3522d   bridge              bridge    local
205f46f5b907   host                host      local
856ac8b90e9b   mynet               bridge    local  # 这就是我们刚创建的网络
8d0210334194   none                null      local
9cad2d367255   proxypool_default   bridge    local
  • 现在我们就可以使用刚刚创建的网络运行容器试试了!
xiaoqiang@xiaoqiangclub:~/studyArea/dockerStudynbsp;docker run -it --net=mynet my-ubuntu
root@59052c9eca94:/usr/local# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.2  netmask 255.255.0.0  broadcast 192.168.255.255 # 使用了我们刚创建的网络
        ether 02:42:c0:a8:00:02  txqueuelen 0  (Ethernet)
        RX packets 23  bytes 4216 (4.2 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
  • 可以添加--ip指定容器的ip(在网卡的网段内),例如:docker run -it --net mynet --ip 192.168.0.66 my-ubuntu

保存镜像

  • 使用docker save将指定镜像保存成 tar 归档文件,来看一下它的参数
xiaoqiang@xiaoqiangclub:~/桌面nbsp;docker save --help

Usage:  docker save [OPTIONS] IMAGE [IMAGE...]

Save one or more images to a tar archive (streamed to STDOUT by default)

Options:
  -o, --output string   输入文件
  • 例如docker save -o /home/xiaoqiang/桌面/myProjects/my-django-web-image.tar xiaoqiangclub/django-web:v1.0

导入镜像

  • 使用docker load 导入docker save 命令导出的镜像,参数
xiaoqiang@xiaoqiangclub:~/桌面nbsp;docker load --help

Usage:  docker load [OPTIONS]

Load an image from a tar archive or STDIN

Options:
  -i, --input string   # 指定导入的文件,代替 STDIN
  -q, --quiet          # 精简输出信息
  • 例如docker load --input my-django-web-image.tar,也可以docker load < my-django-web-image.tar

推送镜像到hub

  • docker login docker logout登入登出
  • 参考文章
  • 阿里云复制下来的操作指南

1. 登录阿里云Docker Registry
$ docker login --username=xiaoqiang**** registry.cn-hangzhou.aliyuncs.com
用于登录的用户名为阿里云账号全名,密码为开通服务时设置的密码。

您可以在访问凭证页面修改凭证密码。

2. 从Registry中拉取镜像
$ docker pull registry.cn-hangzhou.aliyuncs.com/xiaoqiangclub/xiaoqiangclub:[镜像版本号]
3. 将镜像推送到Registry
$ docker login --username=xiaoqiang**** registry.cn-hangzhou.aliyuncs.com
$ docker tag [ImageId] registry.cn-hangzhou.aliyuncs.com/xiaoqiangclub/xiaoqiangclub:[镜像版本号]
$ docker push registry.cn-hangzhou.aliyuncs.com/xiaoqiangclub/xiaoqiangclub:[镜像版本号]
请根据实际镜像信息替换示例中的[ImageId]和[镜像版本号]参数。

4. 选择合适的镜像仓库地址
从ECS推送镜像时,可以选择使用镜像仓库内网地址。推送速度将得到提升并且将不会损耗您的公网流量。

如果您使用的机器位于VPC网络,请使用 registry-vpc.cn-hangzhou.aliyuncs.com 作为Registry的域名登录。

5. 示例
使用"docker tag"命令重命名镜像,并将它通过专有网络地址推送至Registry。

$
docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
registry.aliyuncs.com/acs/agent 0.7-dfb6816 37bb9c63c8b2 7 days ago 37.89 MB
$ docker tag 37bb9c63c8b2 registry-vpc.cn-hangzhou.aliyuncs.com/acs/agent:0.7-dfb6816
使用 "docker push" 命令将该镜像推送至远程。

$
docker push registry-vpc.cn-hangzhou.aliyuncs.com/acs/agent:0.7-dfb6816

相关推荐

为何越来越多的编程语言使用JSON(为什么编程)

JSON是JavascriptObjectNotation的缩写,意思是Javascript对象表示法,是一种易于人类阅读和对编程友好的文本数据传递方法,是JavaScript语言规范定义的一个子...

何时在数据库中使用 JSON(数据库用json格式存储)

在本文中,您将了解何时应考虑将JSON数据类型添加到表中以及何时应避免使用它们。每天?分享?最新?软件?开发?,Devops,敏捷?,测试?以及?项目?管理?最新?,最热门?的?文章?,每天?花?...

MySQL 从零开始:05 数据类型(mysql数据类型有哪些,并举例)

前面的讲解中已经接触到了表的创建,表的创建是对字段的声明,比如:上述语句声明了字段的名称、类型、所占空间、默认值和是否可以为空等信息。其中的int、varchar、char和decimal都...

JSON对象花样进阶(json格式对象)

一、引言在现代Web开发中,JSON(JavaScriptObjectNotation)已经成为数据交换的标准格式。无论是从前端向后端发送数据,还是从后端接收数据,JSON都是不可或缺的一部分。...

深入理解 JSON 和 Form-data(json和formdata提交区别)

在讨论现代网络开发与API设计的语境下,理解客户端和服务器间如何有效且可靠地交换数据变得尤为关键。这里,特别值得关注的是两种主流数据格式:...

JSON 语法(json 语法 priority)

JSON语法是JavaScript语法的子集。JSON语法规则JSON语法是JavaScript对象表示法语法的子集。数据在名称/值对中数据由逗号分隔花括号保存对象方括号保存数组JS...

JSON语法详解(json的语法规则)

JSON语法规则JSON语法是JavaScript对象表示法语法的子集。数据在名称/值对中数据由逗号分隔大括号保存对象中括号保存数组注意:json的key是字符串,且必须是双引号,不能是单引号...

MySQL JSON数据类型操作(mysql的json)

概述mysql自5.7.8版本开始,就支持了json结构的数据存储和查询,这表明了mysql也在不断的学习和增加nosql数据库的有点。但mysql毕竟是关系型数据库,在处理json这种非结构化的数据...

JSON的数据模式(json数据格式示例)

像XML模式一样,JSON数据格式也有Schema,这是一个基于JSON格式的规范。JSON模式也以JSON格式编写。它用于验证JSON数据。JSON模式示例以下代码显示了基本的JSON模式。{"...

前端学习——JSON格式详解(后端json格式)

JSON(JavaScriptObjectNotation)是一种轻量级的数据交换格式。易于人阅读和编写。同时也易于机器解析和生成。它基于JavaScriptProgrammingLa...

什么是 JSON:详解 JSON 及其优势(什么叫json)

现在程序员还有谁不知道JSON吗?无论对于前端还是后端,JSON都是一种常见的数据格式。那么JSON到底是什么呢?JSON的定义...

PostgreSQL JSON 类型:处理结构化数据

PostgreSQL提供JSON类型,以存储结构化数据。JSON是一种开放的数据格式,可用于存储各种类型的值。什么是JSON类型?JSON类型表示JSON(JavaScriptO...

JavaScript:JSON、三种包装类(javascript 包)

JOSN:我们希望可以将一个对象在不同的语言中进行传递,以达到通信的目的,最佳方式就是将一个对象转换为字符串的形式JSON(JavaScriptObjectNotation)-JS的对象表示法...

Python数据分析 只要1分钟 教你玩转JSON 全程干货

Json简介:Json,全名JavaScriptObjectNotation,JSON(JavaScriptObjectNotation(记号、标记))是一种轻量级的数据交换格式。它基于J...

比较一下JSON与XML两种数据格式?(json和xml哪个好)

JSON(JavaScriptObjectNotation)和XML(eXtensibleMarkupLanguage)是在日常开发中比较常用的两种数据格式,它们主要的作用就是用来进行数据的传...

取消回复欢迎 发表评论:

请填写验证码