Hello,
I’m having an issue creating a service using my own custom image.
Here are the things I did:
- Build a custom image
docker build -t mongo1_test .
Here is the docker file:
FROM thanh/mongo
RUN apt-get update
ADD startup.sh /tmp
CMD mongod --fork --logpath /data/db/mongo.log --bind_ip_all && /bin/bash
I can see the images in the list:
docker images
mongo1_test latest a1a25c6aca6a 2 days ago 492MB
- Create a service using swarm:
docker service create --replicas 1 --name mongo_service -p 10038:80 mongo1_test
image mongo1_test:latest could not be accessed on a registry to record
its digest. Each node will access mongo1_test:latest independently,
possibly leading to different nodes running different
versions of the image.
fjcpvj375g87lkhh02fys8sja
overall progress: 0 out of 1 tasks
1/1: starting [============================================> ]
^COperation continuing in background.
Use docker service ps fjcpvj375g87lkhh02fys8sja
to check progress.
docker@docker:~/mongo_test$ ^C
docker@docker:~/mongo_test$ ^C
docker@docker:~/mongo_test$
docker@docker:~$ docker service ps fjcpvj375g87lkhh02fys8sja
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
z1el12ouvwx1 mongo_service.1 mongo1_test:latest docker Running Starting 6 seconds ago
mf1j24eb6q5y _ mongo_service.1 mongo1_test:latest docker Shutdown Complete 12 seconds ago
gb6hgui4rxg8 _ mongo_service.1 mongo1_test:latest docker Shutdown Complete 24 seconds ago
zmomw25hrq6z _ mongo_service.1 mongo1_test:latest docker Shutdown Complete 36 seconds ago
vcfv4xbbi3lb _ mongo_service.1 mongo1_test:latest docker Shutdown Complete 47 seconds ago
What I can see is that the container are running and then stops riught away.
No error in the logs.
If i do a docker run with this image, it starts without any problems.
I can even connect to my mongo DB.
So am i doing anything wrong with Swarm?
Thanks for your help.