Skip to main content
added 208 characters in body
Source Link
whitebear
  • 705
  • 5
  • 13
  • 28

I used expose in docker file and open the port.

However still problem occurs though, @BMitch's answer ports is also the necessary solution in this case.

For now, My first problem is solved. thank you very much.


Latest update.

Latest update.

I used expose in docker file and open the port.

However still problem occurs though, @BMitch's answer ports is also the necessary solution in this case.

For now, My first problem is solved. thank you very much.


Latest update.

added 1764 characters in body
Source Link
whitebear
  • 705
  • 5
  • 13
  • 28

Latest update.

I logined manager and check services docker service ls and containers docker container ls.

then found out

service port is open and container port is not open.

When running container manually you can set like -p 8000:8000.

However in this case, container is launched by stack config yml, ports works for service but not for container.

So,How can I open the port of container??

docker service ls

t402qi5kqifz        django_python           global              1/1                 registry:5000/myapp/djangosrc:latest   *:8000->8000/tcp
yadtkm6nhwdc        phpmyadmin_phpmyadmin   global              1/1                 phpmyadmin/phpmyadmin:latest             *:8009->80/tcp
3mvzc1rjc8pg        visualizer_app          global              1/1                 dockersamples/visualizer:latest          *:9009->8080/tcp

docker container ls

CONTAINER ID        IMAGE                                    COMMAND                  CREATED             STATUS                 PORTS               NAMES
1d2b50730959        registry:5000/myapp/djangosrc:latest   "uwsgi --socket :800…"   2 minutes ago       Up 2 minutes                               django_python.ne4qcvhmmtchn3popj26plcmz.20txv4hixixgsvwzw23jmhqln
fd5d42cd5fd6        dockersamples/visualizer:latest          "npm start"              2 hours ago         Up 2 hours (healthy)   8080/tcp            visualizer_app.ne4qcvhmmtchn3popj26plcmz.o60n8gzbxod6p6rmznvpls4z6
fd28f1efd77d        phpmyadmin/phpmyadmin:latest             "/docker-entrypoint.…"   2 hours ago         Up 2 hours             80/tcp              phpmyadmin_phpmyadmin.ne4qcvhmmtchn3popj26plcmz.v1flhjuez68lmhb9erlsoz8wc

I have some services in docker-swarm.

I have some services in docker-swarm.

Latest update.

I logined manager and check services docker service ls and containers docker container ls.

then found out

service port is open and container port is not open.

When running container manually you can set like -p 8000:8000.

However in this case, container is launched by stack config yml, ports works for service but not for container.

So,How can I open the port of container??

docker service ls

t402qi5kqifz        django_python           global              1/1                 registry:5000/myapp/djangosrc:latest   *:8000->8000/tcp
yadtkm6nhwdc        phpmyadmin_phpmyadmin   global              1/1                 phpmyadmin/phpmyadmin:latest             *:8009->80/tcp
3mvzc1rjc8pg        visualizer_app          global              1/1                 dockersamples/visualizer:latest          *:9009->8080/tcp

docker container ls

CONTAINER ID        IMAGE                                    COMMAND                  CREATED             STATUS                 PORTS               NAMES
1d2b50730959        registry:5000/myapp/djangosrc:latest   "uwsgi --socket :800…"   2 minutes ago       Up 2 minutes                               django_python.ne4qcvhmmtchn3popj26plcmz.20txv4hixixgsvwzw23jmhqln
fd5d42cd5fd6        dockersamples/visualizer:latest          "npm start"              2 hours ago         Up 2 hours (healthy)   8080/tcp            visualizer_app.ne4qcvhmmtchn3popj26plcmz.o60n8gzbxod6p6rmznvpls4z6
fd28f1efd77d        phpmyadmin/phpmyadmin:latest             "/docker-entrypoint.…"   2 hours ago         Up 2 hours             80/tcp              phpmyadmin_phpmyadmin.ne4qcvhmmtchn3popj26plcmz.v1flhjuez68lmhb9erlsoz8wc

I have some services in docker-swarm.

added 1206 characters in body
Source Link
whitebear
  • 705
  • 5
  • 13
  • 28

I am trying some staffs but in vain. So I change the way for test purpose.

Put my services as global on the manager in the most simple way.

In the same way I can access phpmyadmin and visualizer.

But even in this case I can't access to localhost:8000

I am afraid there is something blocking the ports in myapp/djangosrc??

It might be happen??

w7g3h9poppb4        django_python           global              1/1                 registry:5000/myapp/djangosrc:latest   *:8000->8000/tcp
yadtkm6nhwdc        phpmyadmin_phpmyadmin   global              1/1                 phpmyadmin/phpmyadmin:latest             *:8009->80/tcp
3mvzc1rjc8pg        visualizer_app          global              1/1                 dockersamples/visualizer:latest          *:9009->8080/tcp



version: '3'
services:
  python:
    image: registry:5000/myapp/djangosrc:latest
    #command: uwsgi --socket :8001 --module myapp.wsgi --py-autoreload 1 --logto /tmp/mylog.log
     
    ports:
      - 8000:8000
    deploy:
      mode: global
      placement:
        constraints: [node.role == manager]

I am trying some staffs but in vain. So I change the way for test purpose.

Put my services as global on the manager in the most simple way.

In the same way I can access phpmyadmin and visualizer.

But even in this case I can't access to localhost:8000

I am afraid there is something blocking the ports in myapp/djangosrc??

It might be happen??

w7g3h9poppb4        django_python           global              1/1                 registry:5000/myapp/djangosrc:latest   *:8000->8000/tcp
yadtkm6nhwdc        phpmyadmin_phpmyadmin   global              1/1                 phpmyadmin/phpmyadmin:latest             *:8009->80/tcp
3mvzc1rjc8pg        visualizer_app          global              1/1                 dockersamples/visualizer:latest          *:9009->8080/tcp



version: '3'
services:
  python:
    image: registry:5000/myapp/djangosrc:latest
    #command: uwsgi --socket :8001 --module myapp.wsgi --py-autoreload 1 --logto /tmp/mylog.log
     
    ports:
      - 8000:8000
    deploy:
      mode: global
      placement:
        constraints: [node.role == manager]
added 109 characters in body
Source Link
whitebear
  • 705
  • 5
  • 13
  • 28
Loading
Source Link
whitebear
  • 705
  • 5
  • 13
  • 28
Loading