为什么docker stack deploy找不到本地镜像?
Why docker stack deploy can't find local image?
这有时工作正常,但有时 docker swarm 无法获取 docker 图像。哪个是本地构建的,这里可能是什么问题?我使用了 --with-registery-auth
也没有用。
请看下面的屏幕截图,其中明确说明我的本地图像可用。
下面是我的docker-compose.yml
version: "3.8"
services:
mongodb:
image: mongo
environment:
MONGO_USER: reddituser
MONGO_PASS: redditpass
MONGO_DB: reddit-demo
deploy:
placement:
constraints:
- node.role == manager
ports:
- "27017:27017"
networks:
- reddit
volumes:
- ./init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js
- mongodb:/data/mongodb
redisdb:
image: redis
volumes:
- redis:/data/
ports:
- "6379"
networks:
- reddit
app:
image: hapi-backend
ports:
- "3000:3000"
environment:
MONGO_HOST: mongodb
MONGO_PORT: "27017"
MONGO_DB: reddit-demo
MONGO_USER: reddituser
MONGO_PASS: redditpass
REDIS_HOST: redisdb
REDIS_PORT: "6379"
networks:
- reddit
micro:
image: beequeue-micro
environment:
MONGO_HOST: mongodb
MONGO_PORT: "27017"
MONGO_DB: reddit-demo
MONGO_USER: reddituser
MONGO_PASS: redditpass
REDIS_HOST: redisdb
REDIS_PORT: "6379"
networks:
- reddit
volumes:
mongodb:
redis:
networks:
reddit:
因为您在本地主机上使用注册表:
所以看看:https://docs.docker.com/engine/swarm/stack-deploy/#set-up-a-docker-registry
在您的 swarm 上将注册表作为服务启动
使用docker service ls
检查其状态
检查它是否与 curl
一起工作
这有时工作正常,但有时 docker swarm 无法获取 docker 图像。哪个是本地构建的,这里可能是什么问题?我使用了 --with-registery-auth
也没有用。
请看下面的屏幕截图,其中明确说明我的本地图像可用。
下面是我的docker-compose.yml
version: "3.8"
services:
mongodb:
image: mongo
environment:
MONGO_USER: reddituser
MONGO_PASS: redditpass
MONGO_DB: reddit-demo
deploy:
placement:
constraints:
- node.role == manager
ports:
- "27017:27017"
networks:
- reddit
volumes:
- ./init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js
- mongodb:/data/mongodb
redisdb:
image: redis
volumes:
- redis:/data/
ports:
- "6379"
networks:
- reddit
app:
image: hapi-backend
ports:
- "3000:3000"
environment:
MONGO_HOST: mongodb
MONGO_PORT: "27017"
MONGO_DB: reddit-demo
MONGO_USER: reddituser
MONGO_PASS: redditpass
REDIS_HOST: redisdb
REDIS_PORT: "6379"
networks:
- reddit
micro:
image: beequeue-micro
environment:
MONGO_HOST: mongodb
MONGO_PORT: "27017"
MONGO_DB: reddit-demo
MONGO_USER: reddituser
MONGO_PASS: redditpass
REDIS_HOST: redisdb
REDIS_PORT: "6379"
networks:
- reddit
volumes:
mongodb:
redis:
networks:
reddit:
因为您在本地主机上使用注册表:
所以看看:https://docs.docker.com/engine/swarm/stack-deploy/#set-up-a-docker-registry
在您的 swarm 上将注册表作为服务启动
使用
检查其状态docker service ls
检查它是否与
一起工作curl