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 ?

  • Docker - maven connect to specific repository in runtime
  • docker - mac - Layer already being pulled by another client, doesn't revolve with restarting mac or vm
  • What is the optimal way to run a Node API in Docker on Amazon ECS?
  • NFS Server on OSX - squash options
  • How to convert a Vagrantfile to a Dockerfile
  • Docker: Unable to commit a built docker image
  • Is Docker for Mac Open Source? [closed]
  • Docker. Celery and code in different containers
  • Importing a python module in Jython StreamSets - ImportError: No module named
  • Unable to create machine in docker
  • Docker containers, memory consumption and logs
  • Can not pull/push images after update docker to 1.12
  • 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
        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
        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.