0

I am trying out some things with docker and docker swarm and currently I am running into a problem.

If I create a container with: docker run -d --name my_nginx -p 8080:80 nginx everythings went fine, I am able to access this port.

If I try to create a service with docker swarm (container was removed before) I am not able to open that port: docker service create -d --name my_service_nginx --replicas=1 -p 8080:80 nginx

It seems that the service does not create a portmapping.

CONTAINER ID   IMAGE          COMMAND                  CREATED         STATUS         PORTS     NAMES
d3417b80036c   nginx:latest   "/docker-entrypoint.…"   6 minutes ago   Up 6 minutes   80/tcp    my_service.1.1l3fwcct1m9hoallkn0g9qwpd

Do you have any idea what I am doing wrong?

Best regards Jan

Jan
  • 3
  • 1
  • *"I am not able to open that port"* – what do you mean here exactly? I just tried with `curl` and I got the exact same result both times. – slauth Oct 27 '21 at 13:21
  • If I do a curl like this: curl localhost:8080 I get the following error: curl: (7) Failed to connect to localhost port 8080: Connection refused – Jan Oct 27 '21 at 13:27
  • Which OS do you use? – slauth Oct 27 '21 at 13:48
  • Did a little bit of testing meanwhile... It seems that it is related to my host which is an LXC-Container in proxmox. If I run that service in a regular debian vm the service is reachable. – Jan Oct 27 '21 at 13:48
  • The LXC container was an Ubuntu 20.04, the debian vm is debian 11. – Jan Oct 27 '21 at 13:50

2 Answers2

0

Launching a Docker swarm on the LXC is not possible:

Docker swarm get access from outside network

Sergey Kozlov
  • 452
  • 5
  • 17
0

I am able to access Docker swarm on the Proxmox LXC by enabling ip_forward for ingress_sbox namespace.

nsenter --net=/run/docker/netns/ingress_sbox sysctl -w net.ipv4.ip_forward=1

AMing
  • 5,532
  • 2
  • 24
  • 15