rancher-sandbox / rancher-desktop

Container Management and Kubernetes on the Desktop
https://rancherdesktop.io
Apache License 2.0
5.89k stars 277 forks source link

docker swarm ports not being exposed #5552

Open jmoseman01 opened 1 year ago

jmoseman01 commented 1 year ago

Actual Behavior

When I do a docker stack deploy -c docker-stack-local.yml inyo-stack the containers start but the port's aren't exposed. I'm using the ports yaml attribute

services:
    postgres:
        ports:
           - 5432:5432

I get connection errors when trying to connect to postgres even though the server seems to be running fine in the logs.

Steps to Reproduce

  1. setup a docker swarm stack yml file with a postgress image containing the proper exposed port in the ports field
  2. run docker stack deploy -c docker-stack-local.yml inyo-stack
  3. try to connect to it with any database connection tool and see connection refused

Result

connection failure

Expected Behavior

connection success

Additional Information

No response

Rancher Desktop Version

1.7.0

Rancher Desktop K8s Version

I'm not using kubernetes

Which container engine are you using?

moby (docker cli)

What operating system are you using?

macOS

Operating System / Build Version

Ventura 13.4

What CPU architecture are you using?

x64

Linux only: what package format did you use to install Rancher Desktop?

None

Windows User Only

No response

gaktive commented 1 year ago

Hi @jmoseman01!

Are you able to try this with the latest version (1.10) and see if this problem still happens?

Otherwise, can you provide some additional minimal config to help me be able to reproduce this issue? Do you also have any of the connection errors you spotted in the logs?

Thanks!

sanzoghenzo commented 1 month ago

I have the same problem on Windows 10, Rancher Desktop version 1.14.0

this is the reduced version of my stack

version: '3.9'

services:
  traefik:
    image: traefik:latest
    networks: [reverse-proxy]
    ports: [80:80, 443:443, 8080:8080]
    environment: [TZ=Europe/Rome]
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /usr/share/zoneinfo:/usr/share/zoneinfo:ro
    command:
      - --api.dashboard=true
      - --api.insecure=true
      - --entryPoints.web.address=:80
      - --providers.swarm.endpoint=unix:///var/run/docker.sock
      - --providers.swarm.exposedByDefault=false
      - --providers.swarm.network=reverse-proxy
    deploy:
      mode: replicated
      replicas: 1
      placement:
        constraints: [node.role == manager]

networks:
  reverse-proxy:
    name: reverse-proxy

if I deploy the stack with

docker stack deploy -c compose.yaml -d=true traefik

the container and service are created correctly

$ docker service ls
ID             NAME              MODE         REPLICAS   IMAGE            PORTS
j5nw72ts9tkc   traefik_traefik   replicated   1/1        traefik:latest   *:80->80/tcp, *:443->443/tcp, *:8080->8080/tcp

$ docker ps
CONTAINER ID  IMAGE           COMMAND                  CREATED         STATUS         PORTS    NAMES
db95783bd8fa  traefik:latest  "/entrypoint.sh --ap…"   6 minutes ago   Up 6 minutes   80/tcp   traefik_traefik.1.bc27r0mp38qiasfqkbwsto2hl

I cannot reach localhost:8080/dashboard/ from windows. I can, however, reach it inside ubuntu WSL, either via curl or firefox.