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 ?

  • Nightmare.js with Docker
  • Why are docker host volumes being mounted incorrectly?
  • When restart docker.io service,some docker containers don't start
  • Using golang connect to docker container with functional tty
  • Com.github.dockerjava.api.exception.DockerClientException: Certificate path (DOCKER_CERT_PATH) ‘/root/.docker/certs’ doesn’t exist General Discussions
  • Seeding a database using Docker Mysql COPY fails
  • bitbucket docker Permission denied (publickey). fatal: Could not read from remote repository
  • Install an sql dump file to a docker container with mariaDB
  • Hadoop and Docker
  • Limit number of processes started inside docker container
  • Auto reloading flask server on Docker
  • Gitlab CI for apache project
  • 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.