Home > Software design >  Passing processes into Docker container
Passing processes into Docker container

Time:07-03

let's say, I'm trying to get 'visible' all processes on docker host inside my container. Is it possible to pass they in, so ps or htop could make them printed?

CodePudding user response:

There is the --pid flag and with --pid=host you can start container in host's pid namespace:

❯ docker run --rm --pid=host debian:buster bash -c 'ls /proc -1 | wc -l'
489

Same goes for docker-compose:

version: "3"
services:
  test:
    pid: host
  • Related