Docker Desktop
用于 windows 下使用 docker
Docker Desktop: The #1 Containerization Tool for Developers | Docker
Overview of Docker Desktop | Docker Docs
部署和协调|Docker插件 --- Deployment and orchestration | Docker Docs
用于管理、扩展和维护容器化应用程序的工具称为orchestration。两个最流行的编排工具是Kubernetes和Docker Swarm。Docker Desktop为这两种编排提供了开发环境。
部署到Kubernetes| Docker插件 --- Deploy to Kubernetes | Docker Docs
部署到Swarm| Docker插件 --- Deploy to Swarm | Docker Docs
Kubernetes
部署到Kubernetes| Docker插件 --- Deploy to Kubernetes | Docker Docs
pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: demo
spec:
containers:
- name: testpod
image: alpine:latest
command: ["ping", "8.8.8.8"]
# 创建 pod
kubectl apply -f ./pod.yaml
# 查看所有 pods
kubectl get pods
# 查看 pods 日志
kubectl logs demo
# 删除 pod
kubectl delete -f ./pod.yaml
Swarm
部署到Swarm| Docker插件 --- Deploy to Swarm | Docker Docs
# 初始化 docker swarm 模式
docker swarm init
# 创建 swarm 服务
docker service create --name demo alpine:latest ping 8.8.8.8
# 查看服务
docker service ps demo
# 查看服务日志
docker service logs demo
# 删除服务
docker service rm demo
stack files
部署到Swarm| Docker插件 --- Deploy to Swarm | Docker Docs
version: '3.7'
services:
bb-app:
image: getting-started
ports:
- "8000:3000"
docker stack deploy -c bb-stack.yaml demo
docker service ls
docker stack rm demo
Kubernetes Services and Swarm Services are very different(Kubernetes服务和Swarm服务非常不同)
Despite the similar name, the two orchestrators mean very different things by the term 'service'. In Swarm, a service provides both scheduling and networking facilities, creating containers and providing tools for routing traffic to them. In Kubernetes, scheduling and networking are handled separately, deployments (or other controllers) handle the scheduling of containers as pods, while services are responsible only for adding networking features to those pods.
尽管名称相似,但这两个乐团在“服务”一词上的含义却截然不同。在Swarm中,服务提供调度和网络设施,创建容器并提供将流量路由到容器的工具。在Kubernetes中,调度和网络是分开处理的,部署(或其他控制器)将容器的调度作为pod处理,而服务只负责向这些pod添加网络功能。
入门指南概述
入门指南概述|Docker插件 --- Overview of the get started guide | Docker Docs
blkio
- No blkio warnings on docker info - Docker Desktop for Windows - Docker Community Forums
- 警告:不支持blkio throttle.read_bps_device。这条消息是什么?-腾讯云开发者社区-腾讯云
- blkio
spec.ports[0].nodePort: Invalid value: xxx: provided port is not in the valid range. The range of valid ports is 30000-32768"
修改 Kubernetes 的 NodePort 端口范围_provided port is not in the valid range. the range-CSDN博客
vi /etc/kubernetes/manifests/kube-apiserver.yaml
# 添加参数,修改后过一会自动生效,无需其他操作。
--service-node-port-range=1-65535
docker desktop 下没有这个路径,需要如下方式进入
docker run -it --privileged --pid=host debian nsenter -t 1 -m -u -n -i sh
# 或者
docker run -it --privileged --pid=host ubuntu nsenter -t 1 -m -u -n -i sh
然后就可以按照上面的操作了
在 Windows 上使用 Docker 桌面的 Kubernetes 配置目录的位置_kubernetes_K8SOQ-K8S/Kubernetes
kubernetes - How to change the default nodeport range on Mac (docker-desktop)? - Stack Overflow
kubernetes - Where are the Docker Desktop for Windows kubelet logs located? - Stack Overflow
Docker Desktop installs two special-purpose internal Linux distros docker-desktop and docker-desktop-data. The first (docker-desktop) is used to run the Docker engine (dockerd) while the second (docker-desktop-data) stores containers and images. Neither can be used for general development.
Docker Desktop安装了两个特殊用途的内部Linux发行版 docker-desktop 和 docker-desktop-data 。第一个( docker-desktop )用于运行Docker引擎( dockerd ),而第二个( docker-desktop-data )用于存储容器和镜像。两者都不能用于一般发展。
最佳做法|Docker插件 --- Best practices | Docker Docs(https://docs.docker.com/desktop/wsl/best-practices/)
当文件从Linux文件系统绑定挂载时,性能要高得多,而不是从Windows主机远程挂载。因此,避免 docker run -v /mnt/c/users:/users,
,其中 /mnt/c
是从Windows安装的。
发表评论