一个非常著名的容器软件
容器:一个轻量级的虚拟机—>应用程序在容器里运行
- 容器消耗的内存,cpu等资源相对虚拟机而言要少,成本更低,管理起来更方便和快捷
降本增效
docker启动镜像的方式—》颠覆了我们传统的软件安装的方式—》非常新颖的软件部署和安装的方式
源代码或者安装程序—》手工去运行–》安装到某台服务器的某个位置—》然后去启动
docker的官方网址:Docker: Accelerated Container Application Development
受到 k8s的排挤
kubernetes —>k8s是容器集群管理软件—》底层是管理容器—>docker,coreOS(rocket)
containerd 是docker开源的底层的容器技术
最新版的k8s: 默认情况下不支持 docker了,使用开源的 containerd
docker 出来2017年 在中国开始流行,目前是比较稳定和拥有大量用户的容器软件
Google、Facebook等巨头
Google --》搞了:云原生基金会–》https://kubernetes.io/ —
kubernetes --》k8s是容器集群管理软件–》底层是管理容器—》docker、coreOS(rocket)、containerd
k8s软件–》排挤docker
containerd
就是容器(像瓶子一样),一个瓶子里放着一个app,也就是一个应用程序(进程)
每个容器是相对独立的,它们共享操作系统的内核,但拥有自己的文件系统、进程空间、网络等资源。
在理论上,可以在一台主机上运行多个容器,每个容器都可以包含一个独立的应用程序。
容器技术的设计目标之一是实现高效的资源利用,因此可以在一台主机上同时运行多个容器,具体取决于主机的硬件资源(CPU、内存、存储等)以及容器本身的资源需求。
docker容器可以被限制使用宿主机的cpu和内存、网络、磁盘IO资源
官方安装网址:在 CentOS 上安装 Docker 引擎 |Docker 文档
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
[root@docker-1 ~]# sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
已加载插件:fastestmirror
adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
[root@docker-1 ~]# cd /etc/yum.repos.d/
[root@docker-1 yum.repos.d]#
[root@docker-1 yum.repos.d]# ls
CentOS-Base.repo CentOS-fasttrack.repo CentOS-Vault.repo
CentOS-CR.repo CentOS-Media.repo CentOS-x86_64-kernel.repo
CentOS-Debuginfo.repo CentOS-Sources.repo docker-ce.repo
docker-ce.repo---->文件里告诉我们的服务器去哪里下载软件的网址
'下载之后会生成仓库文件在:/etc/yum.repos.d/'
sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
[root@docker-1 yum.repos.d] sudo systemctl start docker
[root@docker-1 yum.repos.d]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@docker-1 yum.repos.d]#
[root@docker-1 yum.repos.d] ps aux|grep docker
root 23895 0.1 1.3 1697180 53732 ? Ssl 10:40 0:00 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
root 24074 0.0 0.0 112824 976 pts/0 S+ 10:41 0:00 grep --color=auto docker
[root@docker-1 yum.repos.d]#
[root@docker-1 yum.repos.d] service firewalld stop
Redirecting to /bin/systemctl stop firewalld.service
[root@docker-1 yum.repos.d] systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@docker-1 yum.repos.d]#
[root@docker-1 yum.repos.d] setenforce 0
[root@docker-1 yum.repos.d] vim /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled #修改为disabled
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@docker-1 yum.repos.d]#
[root@docker-1 yum.repos.d] service docker restart
Redirecting to /bin/systemctl restart docker.service
[root@docker-1 yum.repos.d]#
[root@docker-1 yum.repos.d] iptables -t nat -L
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
DOCKER all -- anywhere anywhere ADDRTYPE match dst-type LOCAL
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
DOCKER all -- anywhere !loopback/8 ADDRTYPE match dst-type LOCAL
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE all -- 172.17.0.0/16 anywhere
Chain DOCKER (2 references)
target prot opt source destination
RETURN all -- anywhere anywhere
[root@docker-1 yum.repos.d]#
[root@docker-1 yum.repos.d] sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
c1ec31eb5944: Pull complete
Digest: sha256:4bd78111b6914a99dbc560e6a20eab57ff6655aea4a80c50b0c5491968cbc2e6
Status: Downloaded newer image for hello-world:latest
Hello from Docker! --->'表示成功了'
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
[root@docker-1 yum.repos.d]#
1.镜像 (image)—>包含了一个微型操作系统
+业务核心代码
+其他依赖软件的软件单元
image=micro OS + app code + 其他库
2.仓库 repository: 网上存放镜像
的地方,docker官方提供了,阿里云也提供
镜像的集市
镜像是别人做出来上传到仓库里的
3.容器 container :运行镜像的地方,在操作系统里本质上就是启动一个进程来运行镜像,将镜像里的软件在一个隔离的环境里运行---->相当于给每个花瓶装到一个观光的那种玻璃隔离框
[root@docker-1 yum.repos.d] sudo mkdir -p /etc/docker
[root@docker-1 yum.repos.d] sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://naxm4z64.mirror.aliyuncs.com"]
}
EOF
{
"registry-mirrors": ["https://naxm4z64.mirror.aliyuncs.com"]
}
[root@docker-1 yum.repos.d] cd /etc/docker/
[root@docker-1 docker] ls
daemon.json
[root@docker-1 docker] cat daemon.json
{
"registry-mirrors": ["https://naxm4z64.mirror.aliyuncs.com"]
}
[root@docker-1 docker] sudo systemctl daemon-reload
[root@docker-1 docker] sudo systemctl restart docker
[root@docker-1 docker]#
查看docker里边有哪些镜像
[root@docker-1 docker] docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest d2c94e258dcb 9 months ago 13.3kB
[root@docker-1 docker]#
拉取镜像
[root@docker-1 docker] docker pull nginx ---> '拉取nginx镜像'
启动容器
docker run --name sc-nginx-1 -p 8080:80 -d --cpu-shares 10 --cpus 1 --cpuset-cpus 0 -m 10000000 nginx
docker run
: 启动一个新的容器。--name sc-nginx-1
: 为容器指定一个名称,这里是"sc-nginx-1"。-p 8080:80
: 将容器内部的端口80映射到主机的端口8080,即容器内的Nginx服务可以通过主机的8080端口访问。-d
: 在后台运行容器,即以守护进程方式运行。--cpu-shares 10
: 设置容器的 CPU 权重。docker将整个cpu资源的算力当做1,分为1000m份 1秒=1000毫秒 1s=1000ms second, 无论你有几个cpu,多少核心都当做1,然后分配成1000份--cpus 1
: 设置容器可使用的 CPU 核心数量为1。--cpuset-cpus 0
: 将容器绑定到主机上的指定 CPU 核心,这里是CPU核心0。-m 10000000
: 设置容器的内存限制为10 MB。nginx
: 指定要运行的镜像,这里是基于Nginx的官方镜像。这个命令的作用是启动一个名为"sc-nginx-1"的Docker容器,运行Nginx服务,将容器内的端口80映射到主机的8080端口,限制容器使用的CPU资源和内存。这些限制和配置可以根据具体需求进行调整。
查看哪些容器正在运行
[root@docker-1 docker] docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
69530abc959e nginx "/docker-entrypoint.…" About a minute ago Up About a minute 0.0.0.0:8080->80/tcp, :::8080->80/tcp sc-nginx-1
[root@docker-1 docker]#
查看容器的详细信息,可以看他的ip地址,网关,网卡类型是桥接—>桥到我们docker0上了
我们的宿主机就编程了—>路由器
[root@docker-1 ~] docker inspect sc-nginx-1
比方说 docker search mysql 查找mysql的镜像有哪些
[root@docker-1 ~] docker search mysql
NAME DESCRIPTION STARS OFFICIAL
mysql MySQL is a widely used, open-source relation… 14806 [OK]
mariadb MariaDB Server is a high performing open sou… 5656 [OK]
percona Percona Server is a fork of the MySQL relati… 624 [OK]
phpmyadmin phpMyAdmin - A web interface for MySQL and M… 934 [OK]
bitnami/mysql Bitnami MySQL Docker Image 106
bitnami/mysqld-exporter 6
cimg/mysql 3
ubuntu/mysql MySQL open source fast, stable, multi-thread… 58
rapidfort/mysql RapidFort optimized, hardened image for MySQL 25
rapidfort/mysql8-ib RapidFort optimized, hardened image for MySQ… 9
google/mysql MySQL server for Google Compute Engine 25
rapidfort/mysql-official RapidFort optimized, hardened image for MySQ… 9
elestio/mysql Mysql, verified and packaged by Elestio 0
hashicorp/mysql-portworx-demo 0
bitnamicharts/mysql 0
databack/mysql-backup Back up mysql databases to... anywhere! 105
linuxserver/mysql A Mysql container, brought to you by LinuxSe… 41
mirantis/mysql 0
docksal/mysql MySQL service images for Docksal - https://d… 0
linuxserver/mysql-workbench 54
vitess/mysqlctld vitess/mysqlctld 1
eclipse/mysql Mysql 5.7, curl, rsync 1
drupalci/mysql-5.5 https://www.drupal.org/project/drupalci 3
drupalci/mysql-5.7 https://www.drupal.org/project/drupalci 0
datajoint/mysql MySQL image pre-configured to work smoothly … 2
[root@docker-1 ~]#
查看正在运行的容器使用的资源消耗(即状态)
[root@docker-1 ~]# docker stats
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
aa1bd7d2ae13 sc-mysql-1 0.11% 213.9MiB / 3.682GiB 5.67% 656B / 0B 0B / 583MB 27
69530abc959e sc-nginx-1 0.00% 5.16MiB / 9.535MiB 54.12% 1.1kB / 0B 26.8MB / 8.19kB 5
[root@docker-1 ~]#
5.16MiB / 9.535MiB 超过10M 容器就会重启,进程被杀死,这样永远不可能超过10M
docker exec 进入容器内部执行命令
-it是开启一个终端 进行交互式操作
sc-mysql-1 容器的名字
bash 进入容器后执行的命令
[root@docker-1 ~] docker exec -it sc-mysql-1 bash
bash-4.2#
停止运行这个容器
[root@docker-1 ~] docker stop sc-mysql-1
sc-mysql-1
[root@docker-1 ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
69530abc959e nginx "/docker-entrypoint.…" 23 hours ago Up 2 hours 0.0.0.0:8080->80/tcp, :::8080->80/tcp sc-nginx-1
[root@docker-1 ~]#
启动这个容器
[root@docker-1 ~] docker start sc-mysql-1
sc-mysql-1
[root@docker-1 ~] docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
aa1bd7d2ae13 mysql:5.7.43 "docker-entrypoint.s…" 35 minutes ago Up Less than a second 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp sc-mysql-1
69530abc959e nginx "/docker-entrypoint.…" 23 hours ago Up 2 hours 0.0.0.0:8080->80/tcp, :::8080->80/tcp sc-nginx-1
[root@docker-1 ~]#
删除一个容器
[root@docker-1 ~] docker ps
sc-nginx-1
4239886edc49 hello-world "/hello" 24 hours ago Exited (0) 24 hours ago blissful_grothendieck
[root@docker-1 ~] docker rm 4239886edc49
4239886edc49
[root@docker-1 ~] docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b370ae562f06 redis "docker-entrypoint.s…" 27 minutes ago Up 27 minutes 6379/tcp my-redis
ca2c341f0475 golang "bash" 32 minutes ago Up 25 minutes my-go
aa1bd7d2ae13 mysql:5.7.43 "docker-entrypoint.s…" About an hour ago Up 46 minutes 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp sc-mysql-1
69530abc959e nginx "/docker-entrypoint.…" 24 hours ago Up 2 hours 0.0.0.0:8080->80/tcp, :::8080->80/tcp sc-nginx-1
[root@docker-1 ~]#
[root@docker-1 docker] docker pull nginx ---> '拉取nginx镜像'
Using default tag: latest
latest: Pulling from library/nginx
a2abf6c4d29d: Pull complete
a9edb18cadd1: Pull complete
589b7251471a: Pull complete
186b1aaa4aa6: Pull complete
b4df32aa5a72: Pull complete
a0bcbecc962e: Pull complete
Digest: sha256:0d17b565c37bcbd895e9d92315a05c1c3c9a29f762b011a10c54a66cd53c9b31
Status: Downloaded newer image for nginx:latest
docker.io/library/nginx:latest
[root@docker-1 docker]#
[root@docker-1 docker] docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest d2c94e258dcb 9 months ago 13.3kB
nginx latest 605c77e624dd 2 years ago 141MB
[root@docker-1 docker]#
启容器
[root@docker-1 docker] docker run --name sc-nginx-1 -p 8080:80 -d --cpu-shares 10 --cpus 1 --cpuset-cpus 0 -m 10000000 nginx
69530abc959e85f9ce4c3f87969344c495028f50051c2ff0829cb24d8102776f
[root@docker-1 docker]#
查看是否运行
[root@docker-1 docker] docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
69530abc959e nginx "/docker-entrypoint.…" About a minute ago Up About a minute 0.0.0.0:8080->80/tcp, :::8080->80/tcp sc-nginx-1
[root@docker-1 docker]#
很成功
先明确:
SNAT(Source Network Address Translation)是一种将源IP地址转换为另一个IP地址的NAT形式。当数据包从内部网络发送到外部网络时,SNAT会将源IP地址替换为NAT设备的外部接口的IP地址,以便外部网络能够正确地将响应数据包发送回内部网络。
DNAT(Destination Network Address Translation)是一种将目标IP地址转换为另一个IP地址的NAT形式。当数据包从外部网络发送到内部网络时,DNAT会将目标IP地址替换为内部网络中的主机的IP地址,以便数据包能够正确地传递到目标主机。
简单的来讲dnat是将公网转换为私网,snat是将 私网转换为公网
WAN(Wide Area Network)和LAN(Local Area Network)是两种网络类型。
LAN是局域网,指的是在相对较小的地理范围内连接在一起的计算机和网络设备的集合,通常在单个建筑物或校园内。LAN通过局域网技术(如以太网)进行连接,提供高速、低延迟的数据传输。
WAN是广域网,指的是连接在较大地理范围内的多个局域网的网络。WAN通过公共网络基础设施(如互联网)或专用连接(如专线或VPN)实现,用于连接跨越城市、国家甚至全球范围的不同地点的网络。
更详细的解释:
Docker的网络结构主要包括四种类型:桥接网络,主机网络,无网络和用户定义网络。
- 桥接网络:这是Docker的默认网络模型。当Docker进程启动时,会在主机上创建一个名为docker0的虚拟网桥,Docker容器将连接到这个虚拟网桥上。每个新创建的容器都会在私有网络中分配到一个IP,可以通过桥接网络与外部网络通信。
- 主机网络:在这种模式下,容器共享主机的网络命名空间,容器可以直接使用主机的网络,无需进行网络转发。
- 无网络:在这种模式下,容器拥有自己的网络命名空间,但不进行任何网络配置。这种模式通常用于需要高度隔离的容器。
- 用户定义网络:Docker允许用户自定义网络,用户可以自定义网络的IP地址范围、子网等信息。用户定义网络可以是桥接网络、覆盖网络或MACVLAN网络。
'拉起镜像'
[root@docker-1 ~] docker pull mysql:5.7.43 #指定特定的版本
5.7.43: Pulling from library/mysql
9ad776bc3934: Pull complete
9e4eda42c982: Pull complete
df6d882cf587: Pull complete
6c804e92b324: Pull complete
fd54ada0c48d: Pull complete
4ed8fb20ac8d: Pull complete
eec2b1bc5454: Pull complete
41c3423057b7: Pull complete
122b2c7b16c0: Pull complete
0d30e03d70e3: Pull complete
71c43898e898: Pull complete
Digest: sha256:4f9bfb0f7dd97739ceedb546b381534bb11e9b4abf013d6ad9ae6473fed66099
Status: Downloaded newer image for mysql:5.7.43
docker.io/library/mysql:5.7.43
[root@docker-1 ~] docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql 5.7.43 3b85be0b10d3 6 months ago 581MB
hello-world latest d2c94e258dcb 9 months ago 13.3kB
nginx latest 605c77e624dd 2 years ago 141MB
[root@docker-1 ~]#
'启动mysql'
-e 是指定容器启动的时候指定环境变量的值: environment
MYSQL_ROOT_PASSWORD--->要指定密码 sc123456
-d 是放到后台运行
[root@docker-1 ~]# docker run --name sc-mysql-1 -e MYSQL_ROOT_PASSWORD=sc123456 -d -p 3306:3306 mysql:5.7.43
aa1bd7d2ae13667d280e40ca034ee732b4545752b624147c3aee422ebeca68c6
[root@docker-1 ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
aa1bd7d2ae13 mysql:5.7.43 "docker-entrypoint.s…" 12 seconds ago Up 11 seconds 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp sc-mysql-1
69530abc959e nginx "/docker-entrypoint.…" 22 hours ago Up About an hour 0.0.0.0:8080->80/tcp, :::8080->80/tcp sc-nginx-1
[root@docker-1 ~]#
在windows的机器上使用MySQL的客户端工具去连接宿主机的3306端口,进入容器
进入mysql容器内部
[root@docker-1 ~] docker exec -it sc-mysql-1 bash
bash-4.2#
bash-4.2# mysql -uroot -psc123456
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.7.43 MySQL Community Server (GPL)
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sanchuang |
| sys |
+--------------------+
5 rows in set (0.00 sec)
mysql>
mysql> create database gaohui;
Query OK, 1 row affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| gaohui |
| mysql |
| performance_schema |
| sanchuang |
| sys |
+--------------------+
6 rows in set (0.00 sec)
mysql>
mysql> exit
Bye
bash-4.2# exit
exit
[root@docker-1 ~]#
启动一个go/python语言环境的容器
[root@docker-1 ~] docker pull golang
docker.io/library/golang:latest
[root@docker-1 ~] docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql 5.7.43 3b85be0b10d3 6 months ago 581MB
hello-world latest d2c94e258dcb 9 months ago 13.3kB
nginx latest 605c77e624dd 2 years ago 141MB
golang latest 276895edf967 2 years ago 941MB
[root@docker-1 ~]#
[root@docker-1 ~] docker run -it -d --name my-go golang bash
root@ca2c341f0475:/go#
启动一个redis的容器
[root@docker-1 ~] docker pull redis
[root@docker-1 ~] docker run -it -d --name my-redis redis bash
b370ae562f067fe2a23aa9b804b4ab2566798b91f1825b626b7bc6310ea2cf6c
查看容器是否启动
[root@docker-1 ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b370ae562f06 redis "docker-entrypoint.s…" 2 minutes ago Up 2 minutes 6379/tcp my-redis
ca2c341f0475 golang "bash" 7 minutes ago Up 3 seconds my-go
aa1bd7d2ae13 mysql:5.7.43 "docker-entrypoint.s…" 56 minutes ago Up 21 minutes 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp sc-mysql-1
69530abc959e nginx "/docker-entrypoint.…" 23 hours ago Up 2 hours 0.0.0.0:8080->80/tcp, :::8080->80/tcp sc-nginx-1
[root@docker-1 ~]#
查看镜像是否存在
[root@docker-1 ~] docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql 5.7.43 3b85be0b10d3 6 months ago 581MB
hello-world latest d2c94e258dcb 9 months ago 13.3kB
nginx latest 605c77e624dd 2 years ago 141MB
golang latest 276895edf967 2 years ago 941MB
redis latest 7614ae9453d1 2 years ago 113MB
[root@docker-1 ~]#
查看启动的容器的详细信息
[root@docker-1 ~] docker inspect my-redis
停止go语言容器
docker stop my-go
再次启动go语言容器
docker start my-go
进入go语言的容器
[root@docker-1 ~] docker exec -it my-go bash
root@ca2c341f0475:/go#
–rm 是退出的时候 删除这个容器
[root@docker-1 yum.repos.d] docker version
Client: Docker Engine - Community ---->'客户端'
Version: 25.0.1
API version: 1.44
Go version: go1.21.6
Git commit: 29cf629
Built: Tue Jan 23 23:12:51 2024
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community ---->'服务端'
Engine:
Version: 25.0.1
API version: 1.44 (minimum version 1.24)
Go version: go1.21.6
Git commit: 71fa3ab
Built: Tue Jan 23 23:11:50 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.27
GitCommit: a1496014c916f9e62104b33d1bb5bd03b0858e59
runc:
Version: 1.1.11
GitCommit: v1.1.11-0-g4bccb38
docker-init:
Version: 0.19.0
GitCommit: de40ad0
[root@docker-1 yum.repos.d]#
k8s, etcd, prometheus, docker —>都是使用go语言编写的
docker images —>查看本机有哪些容器
docker ps —>查看正在运行的容器
docker ps -a —>查看停止的容器
docker run —> 运行容器 ,-p是发布容器出去
docker search go —>可以查找镜像
docker pull 软件名 —>把软件的镜像拉取下来
docker stop 容器名 —>停止容器 这个容器名是自己起的那个
docker-proxy --》是docker提供的一个进程,监听对外发布的端口号–》监听发布的端口
可以用 netstat -antplu 监听
dockerfile : 是制作镜像的配置文件—》配方文件