docker 中的特权模式组合成一个群 [英] privileged mode in docker compose in a swarm
问题描述
我正在使用 docker-compose.yml
在具有树莓派集群的 docker swarm 中部署服务.我的服务需要访问 raspberry pi GPIO 并且需要特权模式.我正在使用 docker 18.02 版和 docker-compose 3.6 版.当我部署堆栈时,我收到以下消息并且没有部署服务:忽略不支持的选项:特权
".有小费吗?下面是我的 docker-compose.yml
文件
I am using docker-compose.yml
to deploy services in a docker swarm which has cluster of raspberry pis. My services require access to the raspberry pi GPIO and needs privileged mode. I am using docker version 18.02 with docker-compose version 3.6. When I deploy the stack, I receive the following message and the services do not get deployed: "Ignoring unsupported options: privileged
". Any tips? Below is my docker-compose.yml
file
version: '3.6'
networks:
swarm_network:
driver: overlay
services:
service1:
image: localrepo/img1:v0.1
privileged: true
deploy:
mode: replicated
replicas: 1
placement:
constraints:
- node.hostname == home-desktop
ports:
- published: 8000
target: 8000
mode: host
networks:
swarm_network:
service2:
image: localrepo/img1:v0.1
privileged: true
deploy:
mode: replicated
replicas: 1
ports:
- published: 7000
target: 7000
mode: host
networks:
swarm_network:
nodeViewer:
image: alexellis2/visualizer-arm:latest
ports:
- "8080:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
deploy:
placement:
constraints: [node.role == manager]
networks:
- swarm_network
推荐答案
那是因为 docker swarm 不支持特权.我有一个类似的 docker compose 在特权模式下运行,但是在使用它来 docker swarm 时,我删除了它们并且运行良好.
Thats because privileged is not supported in docker swarm. I had a similar docker compose running in privileged mode but while using it to docker swarm I removed them and was working well.
这不完全是一个错误.例如,如果您使用诸如 links 或 depends_on 之类的东西.您会收到类似的警告消息.这些只是警告而不是错误.
That not exactly an error .For example if you use something like links or depends_on . You get similar warning message. These are just the warnings not errors.
这就是你实际检查错误日志的方式
This is how you actually check the error logs if there is any
docker service ls (to check running service)
docker service logs servicename
这篇关于docker 中的特权模式组合成一个群的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!