skip to Main Content

I am making stack for docker-swarm.

This is my stack for django and nginx.

I deploy this but it never start.

ID                  NAME                    MODE                REPLICAS            IMAGE                                 PORTS
n9j49jx667x5        django_nginx    replicated          0/1                 nginx:1.13                            *:8000->8000/tcp
7h3sbmmgwbvn        django_python   replicated          0/1                 registry:5000/mydjango:latest   *:8082->8082/tcp
dkzk9z3rdtzm        phpmyadmin_phpmyadmin   global              1/1                 phpmyadmin/phpmyadmin:latest          *:8009->80/tcp
kf6xisbvqdqv        visualizer_app          global              1/1                 dockersamples/visualizer:latest       *:9009->8080/tcp

Now I want to check why this stack dosen’t work.

but how can I check the log or some clue??

If service is once works, I can check like

docker container exec -it manager docker service logs -f visualizer_app

But how can I investigate why stack/service doesn’t work…??

version: '3'
services:
  python:
    image: registry:5000/mydjango:latest
    command: uwsgi --socket :8001 --module jrtweet.wsgi --py-autoreload 1 --logto /tmp/mylog.log
    volumes: 
      - ./src:/code
      - ./src/static:/static
    ports:
      - "8082:8082"
  nginx:
    image: nginx:1.13
    ports:
      - "8000:8000"
    volumes:
      - ./nginx/conf:/etc/nginx/conf.d
      - ./nginx/uwsgi_params:/etc/nginx/uwsgi_params
      - ./static:/static
    depends_on:
      - python

even I tried the most simple setting, but it doesn’t work and I don’t even know how to debug…..


I found out the reason why it dosen’t work try and error.

I commented out #volumes it works, but this must be a another question…

I still want to know the debug of service launch…..


THanks to taleodor I can found the log service ps

docker container exec -it man docker service ps django_python


mbx47zczllwm        django_python.1       registry:5000/myprog/djangosrc:latest   6b0938c9c5fb        Ready               Rejected less than a second ago   "invalid mount config for type…"   
xgpet2jwwocq         _ django_python.1   registry:5000/myprog/djangosrc:latest   6b0938c9c5fb        Shutdown            Rejected less than a second ago   "invalid mount config for type…"   
zl1z7a0qx330         _ django_python.1   registry:5000/myprog/djangosrc:latest   6b0938c9c5fb        Shutdown            Rejected 38 seconds ago           "invalid mount config for type…"   
zewlsc76zluy         _ django_python.1   registry:5000/myprog/djangosrc:latest   6b0938c9c5fb        Shutdown            Rejected about a minute ago       "invalid mount config for type…"   
zytucyx6unsg         _ django_python.1   registry:5000/myprog/djangosrc:latest   6b0938c9c5fb        Shutdown            Rejected about a minute ago       "invalid mount config for type…"   
zqjdobhkti47         _ django_python.1   registry:5000/myprog/djangosrc:latest   6b0938c9c5fb        Shutdown            Rejected about a minute ago       "invalid mount config for type…"   
zxe18cc554ev         _ django_python.1   registry:5000/myprog/djangosrc:latest   6b0938c9c5fb        Shutdown            Rejected about a minute ago       "invalid mount config for type…"  

2

Answers


    1. Do docker service ps, i.e.:

      docker service ps django_nginx

    2. This will give you clues about attempts to start server and possible errors. If the error is clear enough, stop there.

    3. If the error is not clear – and containers were started but exited quickly, locate those containers via docker ps and get their logs via

      docker logs container_id

    Login or Signup to reply.
  1. Scheduling level errors, like “image not found”, “no suitable node for placement constraint” or “volume plugin errors” can be identified like this:
    docker service ps django_python --no-trunc

    --no-trunc will prevent the error message to be cut off.

    Swarm deployments require bind-mounts (the type you try to use) to use absolute paths.

    Lets assume your docker-compose.yml is located in /home/user/docker-compose.yml and you want to use the hostpath /home/user/test as “volume source”. Then you actualy need to use the absolute path /home/user/tests and not the relative path ./test, like you did in your examples.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search