Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

host pid mode in swarm mode. #5624

Closed
asleea88 opened this issue Dec 27, 2017 · 6 comments
Closed

host pid mode in swarm mode. #5624

asleea88 opened this issue Dec 27, 2017 · 6 comments

Comments

@asleea88
Copy link
Contributor

Problem description

Swarm mode doesn't support host pid mode with pid option?. as my testing It seems not and I couldn't find any information anywhere on that.

As I know, the document remarks some different support between docker-compose and swarm mode. however, when it comes to pid, there is no mention about that pid option is not supported in swarm mode. I want a container to share PID namespace with host OS in swarm mode to manage processes on manager node.

This un-support is on purpose?

Problem location

version: '3.4'
services:
    test:
        image: ubuntu:16.04
        command: tail -f /dev/null
        pid: host
$ docker stack deploy -c docker-compose.yml pid_share

$ docker ps 
CONTAINER ID        IMAGE                             COMMAND               CREATED             STATUS              PORTS               NAMES
8a2d4b439efa        asleea/simple_test:latest         "tail -f /dev/null"   2 hours ago         Up 2 hours                              test_test.qdma0yzo931ydcsuc6z5lef3n.w1h4vwox5o6lmt51ugt01w4a8

$ docker exec -it test_test.qdma0yzo931ydcsuc6z5lef3n.w1h4vwox5o6lmt51ugt01w4a8 top
top - 07:02:53 up  5:09,  0 users,  load average: 0.06, 0.04, 0.00
Tasks:   2 total,   1 running,   1 sleeping,   0 stopped,   0 zombie
%Cpu(s):  1.2 us,  0.3 sy,  0.0 ni, 98.5 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  8154208 total,  6221900 free,   691592 used,  1240716 buff/cache
KiB Swap:  8386556 total,  8386556 free,        0 used.  7052380 avail Mem 

   PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                                                                                 
     5 root      20   0   36636   2988   2560 R   0.3  0.0   0:00.02 top                                                                                                                     
     1 root      20   0    4412    680    608 S   0.0  0.0   0:00.04 tail 

The top command show only processes in the container but host OS.

Project version(s) affected

docker 17.09.0-ce
docker-compose 1.17.0

@thaJeztah
Copy link
Member

Correct --pid=host is not currently supported for Swarm services (see moby/moby#25303).

Opened docker/cli#768 to print a warning if this option is used

@mdlinville
Copy link

We document limitations about flags in the repo @thaJeztah posted. Thanks! Closing this one.

@thaJeztah
Copy link
Member

Perhaps it still needs a mention in the compose file reference (haven't checked yet)

@odama626
Copy link

It seems like everything but the tasks is working in swarm, and looking into psutils it looks like exposing psutil.PROCFS_PATH through an environment variable or something could allow this to work?

giampaolo/psutil#1011 (comment)

@tomdaley92
Copy link

Perhaps it still needs a mention in the compose file reference (haven't checked yet)

I just stumbled upon this expected it to work in swarm mode. There is currently no mention of incompatibility with docker swarm in the compose docs.

@docker-robott
Copy link
Collaborator

Closed issues are locked after 30 days of inactivity.
This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

/lifecycle locked

@docker docker locked and limited conversation to collaborators Mar 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants