Docker Swarm : docker stack deploy results on unta

2019-09-01 03:21发布

问题:

I'm deploying some images from my registry into my application server using docker swarm mode host :

My image in the registry is looking like this (executing docker images) :

REPOSITORY                                                 TAG                   IMAGE ID            CREATED            SIZE
localhost:5000/myApp                                       G02R00C09_myTag   c1fc2242f9a0        2 hours ago         272MB

Under my docker compose file , my service looks like this :

---
version: '3.4'
services:
  ihm:
    image: myRegistryServer:5000/myApp:G02R00C09_myTag   
    stdin_open: true
    volumes:
    - /opt/logs:/opt/logs
    tty: true
    ports:
      - target: 80
        published: 80
        protocol: tcp
        mode: host
    deploy:
      mode: global
      placement:
        constraints:
          - node.labels.type == abc
    healthcheck:
      disable: true

-> after executing docker stack deploy :

i got my stack and my service well running (when i run docker stack ls and docker service ls , everything is ok)

-> but when running docker images , i do get my image but with <none> tag:

image:  myRegistryServer:5000/myApp      <none> 

回答1:

This is normal. When using Swarm Stacks, it converts your tag into the SHA256 of that image and downloads that specific ID. This guarantees each node has the same image. If it only depended on the tag, you could potentially re-use the tag in a docker push, and it's possible for different nodes to download different images.

You can see the tag used in a docker service ls or docker stack ps <stackname>