百度360必应搜狗淘宝本站头条
当前位置:网站首页 > 技术文章 > 正文

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

nanshan 2024-11-04 13:04 21 浏览 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

相关推荐

Centos7虚拟机安装及网络配置(二)

#二、centos7的网络配置-Nat模式NAT模式也是VMware创建虚拟机的默认网络连接模式。使用NAT模式网络连接时,VMware会在主机上建立单独的专用网络,用以在主机和虚拟机之间相互通信。虚...

网络分析shell脚本(实时流量+连接统计)

介绍一个强大的分析网络的shell脚本,此脚本是从EZHTTP拆分出来的,觉得有必要单独介绍下。脚本运行效果截图:此脚本包含的功能有:1、实时监控任意网卡的流量2、统计10秒内平均流量3、统计每个端口...

Centos之Could not retrieve mirrorlist解决方案

Centos之Couldnotretrievemirrorlist解决方案:vi/etc/sysconfig/network-scripts/ifcfg-你的网卡名字修改:ONBOOT=ye...

一文掌握!VirtualBox 中 Rock9.x(Linux)网络配置全攻略

一、前言记得我有一篇文章《必看!VirtualBox中Centos7(Linux)网络配置全攻略》讲的非常明细,但是因为CentOS已经停止维护了,可能很多人都不想继续学CentOS,我也是一样,...

CentOS 6.0 设置IP地址、网关、DNS

在做任何操作之前先备份原文件,我们约定备份文件的名称为:源文件名称+bak,例如原文件名称为:centos.txt那么备份文件名称为:centos.txtbak引言:linux的网卡IP地址是存放在文...

Linux CentOS 基础操作(centos怎么操作)

简介:养成学习Linux的好习惯,第一是多查看manpage(manual)等帮助文档和利用好Tab键;第二是掌握好一些快捷键,比如ctrl+c(停止当前进程),ctrl+r(查看命令历史)...

Linux抓包王者技能!这条命令直接封神,教你精准定位网络问题

在网络故障排查和性能调优中,抓包是一项必不可少的技能。对于Linux环境下的网络工程师和运维人员来说,掌握高效抓包方法至关重要。而要说“抓包界的王炸”,那非tcpdump莫属!今天,我们不仅要介绍...

「干货」如何在 Linux 上划分VLAN?

在某些场景中,我们希望在Linux服务器(CentOS/RHEL)上的同一网卡分配来自不同VLAN的多个ip。这可以通过启用VLAN标记接口来实现,但要实现这一点,首先必须确保交换机上添加多个vl...

CentOS 8 网络配置实战教程:静态IP、路由与DNS设置

一、配置前准备1.查看当前网络信息#查看所有网络接口nmclidevicestatus#查看指定网卡信息(假设网卡名为ens192)ipaddrshowens192#查看路由...

Debian10.7修改网络配置(debian怎么配置网络)

简介:关于Debian获取IP地址的方法主要有两种,动态获取和静态设置。在配置网络之前先要知道Debian的网卡名称是什么,Debian可通过命令#ipa查看网卡名称。本文主要通过介绍Debian...

巧用SSH转发功能深入穿透内网(ssh转发udp)

ssh能够提供客户端到服务端的加密传输,当http、ftp等协议被防火墙所拦截时,可以考虑使用SSH的端口转发功能,将其它TCP端口的网络数据通过SSH连接来转发。转发方式一共有三种,分别是:动态转发...

CentOS Linux 7 的IP地址配置(centos7.4配置ip地址)

前段时间有位朋友,在一台PC机上安装了CentOSLinux7系统,因为要接入局域网,需要配置IP地址和默认网关信息。于是参照一本Linux教程上编辑网卡配置信息的方法,输入:vim/etc/s...

教你如何在 Linux 上划分VLAN(linux怎么分区详解)

在某些场景中,我们希望在Linux服务器(CentOS/RHEL)上的同一网卡分配来自不同VLAN的多个ip。这可以通过启用VLAN标记接口来实现,但要实现这一点,首先必须确保交换机上添加多个vl...

打通数据高速公路:如何在 CentOS 上使用 Thunderbolt 3 和 4

Thunderbolt3与4是现代高速外设连接的代表,带来了40Gbps的惊人带宽,支持数据、视频、音频与供电的“四合一”功能,尤其在专业视频编辑、科研计算、虚拟化扩展等领域具有巨大价值...

VMware 虚拟机 CentOS7 桥接模式静态 IP 配置全攻略

虚拟机桥接模式原理配置成桥接网络连接模式的虚拟机就当作主机所在以太网的一部分,虚拟系统和宿主机器的关系,就像连接在同一个Hub上的两台电脑,可以像主机一样可以访问以太网中的所有共享资源和网络连接,可以...

取消回复欢迎 发表评论: