When we execute docker run ubuntu:14.04 ps ax, where does ps ax command runs?

I am new to docker and have been reading the docs and i understand the concept of userspace and kernel space. so when we run the above command i.e. docker run ubutnu:14.04, it download a ubutnu image(which does not have kernel) and runs it inside the container and then fires the command ps ax. my question is where the ps ax command executes? does it execute on the host OS(which is a linux kernel as docker runs on linux) or does it execute inside the container and shows all the processes running in the ubuntu user-space ?

  • Error in build from Dockerfile for Ubuntu image with Mono installed
  • Docker: reload a nodejs app with nodemon
  • how to set ulimit / file descriptor on docker container the image tag is phusion/baseimage-docker
  • Is there any way to compile and statically link ruby libs for Docker?
  • Error when running jekyll docker container with boot2docker on Mac
  • gem install fails when building an image on Docker for Windows
  • Creating demo Data to all apps and keeping it in Dockerfile
  • marathon instances are not running
  • Writing data to file in Dockerfile
  • Docker Tooling for Eclipse - how to connect to docker daemon running inside VM
  • create jenkins image with docker
  • CrashLoopBackOff in spark cluster in kubernetes: nohup: can't execute '--': No such file or directory
  • One Solution collect form web for “When we execute docker run ubuntu:14.04 ps ax, where does ps ax command runs?”

    The output of the ps command should answer that question quite clearly. Here is ps ax running on my host:

    $ ps ax
      PID TTY      STAT   TIME COMMAND
        1 ?        Ss     0:10 /usr/lib/systemd/systemd --switched-root --system --deserialize 23
        2 ?        S      0:00 [kthreadd]
        3 ?        S      0:08 [ksoftirqd/0]
        7 ?        S      2:20 [rcu_sched]
        8 ?        S      0:00 [rcu_bh]
        9 ?        S      1:31 [rcuos/0]
       10 ?        S      0:00 [rcuob/0]
       [...many lines later...]
       20565 pts/3    R+     0:00 ps ax
    

    And here it is running with docker run:

    $ docker run ubuntu ps ax
      PID TTY      STAT   TIME COMMAND
        1 ?        Rs+    0:00 ps ax
    

    When you run docker run ubuntu:14.04 ps ax, your are running the ps command inside the container, and ps will only be able to see other processes running inside the same container.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.