简介
doker run 方式
docker pull portainer/portainer-ce
docker volume create portainer_data
docker run -d -p 9000:9000 --name portainer -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer
docker compose 方式
version: '3.7'
services:
portainer:
image: portainer/portainer
ports:
- "8000:8000"
- "9000:9000"
volumes:
- portainer_data:/data
- /var/run/docker.sock:/var/run/docker.sock
volumes:
portainer_data:
docker compose up -d
docker swarm 方式
version: '3.5'
services:
portainer:
hostname: portainer
image: portainer/portainer-ce:latest
ports:
- target: 9000
published: 9000
mode: host
volumes:
- portainer_data:/data
- /var/run/docker.sock:/var/run/docker.sock
volumes:
portainer_data:
docker stack deploy --compose-file .\docker-compose-deploy-portainer.yml portainer
k8s 方式
# cat portainer-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: portainer
namespace: middle
spec:
selector:
matchLabels:
app: portainer
replicas: 1
template:
metadata:
labels:
app: portainer
spec:
containers:
- name: portainer
image: protainer/portainer
volumeMounts:
- mountPath: /data
name: portainer-data
- mountPath: /var/run/docker.sock
name: docker-sock
resources:
limits:
cpu: 500m
memory: 1Gi
requests:
cpu: 200m
memory: 500Mi
volumes:
- name: portainer-data
persistentVolumeClaim:
claimName: portainer-data-pvc
- name: docker-sock
hostPath:
path: /var/run/docker.sock
---
apiVersion: v1
kind: Service
metadata:
name: portainer
namespace: middle
spec:
type: NodePort
selector:
app: portainer
ports:
- port: 9000
targetPort: 9000
nodePort: 30007
X
帅哥美女如果觉得有帮助,打赏一下呀,不多,就 1 块~~~
发表评论