Skip to content

host pid mode in swarm mode. #5624

Closed
Closed

Description

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions