I have a docker container deployed on a swarm network that I initiated and updated using docker node update
. The docker compose file is:
version: '3.8'
networks:
test:
driver: overlay
attachable: true
services:
identity_vdr:
networks:
- test
image: identity_vdr:1.0
ports:
- "9701:9701"
- "9702:9702"
deploy:
replicas: 1
placement:
constraints: [node.hostname == indy1]
I exposed these ports in the Dockerfile, and when I do build and run in this container, it works well. When I deploy the stack, no error message is shown, instead, the container finishes every few seconds and a new one is created automaticall:
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
g8exkoszfivi node-1-stack_identity_vdr.1 identity_vdr:1.0 indy1 Running Starting 1 second ago
o7an7o4r4cnj _ node-1-stack_identity_vdr.1 identity_vdr:1.0 indy1 Shutdown Complete 6 seconds ago
ogwtjvct1d26 _ node-1-stack_identity_vdr.1 identity_vdr:1.0 indy1 Shutdown Complete 13 seconds ago
qu0is4xgl3zq _ node-1-stack_identity_vdr.1 identity_vdr:1.0 indy1 Shutdown Complete 21 seconds ago
b7z9k3aqxok1 _ node-1-stack_identity_vdr.1 identity_vdr:1.0 indy1 Shutdown Complete 27 seconds ago
The last command of my Docker file is CMD ["bash"]
and I thought this could be the problem, but removing it didn’t change anything. I wonder where I can check why the container does not stay up, as doing docker logs <ID>
is not a valid command in a stack.