question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Publish service port in host mode

See original GitHub issue

Hello,

I’m trying to create a service publishing a port in host mode with the Python SDK, but i don’t see option to do so 😦

It is possible via docker command line (https://docs.docker.com/engine/reference/commandline/service_create/#options) : docker service create -p mode=host,published=80,target=80 --name test httpd

It is also possible via docker-compose:

services:
  test:
    image: httpd
    ports:
      - mode: host
        target: 80
        published: 80
    deploy:
      mode: replicated
      replicas: 1

Is there a way to achieve the same result via python SDK ?

Thanks !

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
shin-commented, Jul 23, 2019

@jgeryk I believe you are mistaken.

Exposed ports that this service is accessible on from the outside, in the form of […] { published_port: <port_config_tuple> }. Port config tuple format is (target_port [, protocol [, publish_mode]]).

1reaction
jgerykcommented, Jul 24, 2019

I don’t know how I missed that. Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deploy services to a swarm - Docker Documentation
To publish a service's port directly on the node where it is running, use the mode=host option to the --publish flag. Note: If...
Read more >
Publish port in Docker Swarm host network - Stack Overflow
host mode port publishing exposes ports only on the host where specific service tasks are running. The port is mapped directly to the ......
Read more >
Understanding Docker's -net=host Option | MetricFire Blog
In this post we will learn briefly about various networking modes available for Docker containers and deep dive into Host Mode networking.
Read more >
Docker port publish host mode and iptables - Server Fault
It works, but also opens all containers with 'host' port publishing like 64321:80 to the world. I have no clue how to filter...
Read more >
Networking - Container Orchestration With Docker Swarm ...
Host mode publishing is useful when you have an external service discovery service and potentially for global services where one task for a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found