Answers: <p>The <code>docker ps</code> command lists containers, and the <code>docker start</code> command does not create new containers, so running it multiple times will not add additional entries to the <code>ps</code> output. Instead, what the <code>start</code> is doing is taking a non-running container and running it. The same would happen automatically with a restart policy on the container. The status in the <code>ps</code> output is the most recent status. Starting the container changes that status, as does stopping the container.</p>
  <p>To create a new container that would be listed in <code>ps</code>, that's <code>docker container create</code>, or just <code>docker create</code>, which makes the container without starting it. Typically, people just use <code>docker run</code> which is a combination of <code>docker create</code> and <code>docker start</code> to create new containers.</p>
  
Answers: CC BY-SA 4.0
Answers: 2022-01-23T17:20:26.433Z
Answers: Many thanks that really helped - so a non-running container can be restarted multiple times?
Answers: user1172468
Answers: CC BY-SA 4.0
Answers: 2022-01-22T16:43:22.320Z
Answers: 2022-01-22T16:43:22.320Z
Answers: BMitch
Body: <p>I'm having trouble understanding the output of <code>docker ps -all</code> after starting the same docker container multiple times (because there is a problem with my understanding of docker).</p>
  <p>To illustrate the issue:</p>
  <ol>
  <li><p>I create a docker container by issuing:
  <code>docker create busybox date</code> which returns something like <code>b48a2a768679dd5cdb767d24f6632d6c3d37f735596bf2b5e47517b495d641af</code></p>
  </li>
  <li><p>Next I do the following:</p>
  </li>
  </ol>
  <pre><code>$ docker start -a b48a2a768679dd5cdb767d24f6632d6c3d37f735596bf2b5e47517b495d641af
  Sat Jan 22 03:14:24 UTC 2022
  
  $ docker start -a b48a2a768679dd5cdb767d24f6632d6c3d37f735596bf2b5e47517b495d641af
  Sat Jan 22 03:14:26 UTC 2022
  
  $ sleep 20
  
  $ docker start -a b48a2a768679dd5cdb767d24f6632d6c3d37f735596bf2b5e47517b495d641af
  Sat Jan 22 03:14:53 UTC 2022
  
  $ docker ps -all
  CONTAINER ID   IMAGE     COMMAND   CREATED              STATUS                     PORTS     NAMES
  b48a2a768679   busybox   &quot;date&quot;    About a minute ago   Exited (0) 4 seconds ago             sad_robinson
  </code></pre>
  <p>Now I see two problems with the docker <code>ps -all</code> output:</p>
  <ol>
  <li><p>I think I should list all my instances of docker start -- since the output was different, I reckon each was a different start of the same container (as you can see I only see one row in the <code>ps -all</code> output)</p>
  </li>
  <li><p>The output from <code>ps -all</code> seems to list the first start as I ran all of these commands right after the other and other than the sleep command all of them returned immediately yet the output of <code>ps -all</code> reflects a start time of &quot;about a minute ago&quot;</p>
  </li>
  </ol>
  
Tags: <docker>
Title: Contradictory output from ps -all after starting a docker container multiple times?
UserDisplayName: user1172468
ThreadText: # Contradictory output from ps -all after starting a docker container multiple times?
  
  (Asked by: username_0 on 2022-01-22)
  
  I'm having trouble understanding the output of `docker ps -all` after starting the same docker container multiple times (because there is a problem with my understanding of docker).
  
  To illustrate the issue:
  
  1. I create a docker container by issuing:
     `docker create busybox date` which returns something like `b48a2a768679dd5cdb767d24f6632d6c3d37f735596bf2b5e47517b495d641af`
  2. Next I do the following:
  
  ```
  $ docker start -a b48a2a768679dd5cdb767d24f6632d6c3d37f735596bf2b5e47517b495d641af
  Sat Jan 22 03:14:24 UTC 2022
  
  $ docker start -a b48a2a768679dd5cdb767d24f6632d6c3d37f735596bf2b5e47517b495d641af
  Sat Jan 22 03:14:26 UTC 2022
  
  $ sleep 20
  
  $ docker start -a b48a2a768679dd5cdb767d24f6632d6c3d37f735596bf2b5e47517b495d641af
  Sat Jan 22 03:14:53 UTC 2022
  
  $ docker ps -all
  CONTAINER ID   IMAGE     COMMAND   CREATED              STATUS                     PORTS     NAMES
  b48a2a768679   busybox   "date"    About a minute ago   Exited (0) 4 seconds ago             sad_robinson
  
  ```
  
  Now I see two problems with the docker `ps -all` output:
  
  1. I think I should list all my instances of docker start -- since the output was different, I reckon each was a different start of the same container (as you can see I only see one row in the `ps -all` output)
  2. The output from `ps -all` seems to list the first start as I ran all of these commands right after the other and other than the sleep command all of them returned immediately yet the output of `ps -all` reflects a start time of "about a minute ago"
  
  **Tags:** docker
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-01-22. Score: 1 | Accepted answer
  
  The `docker ps` command lists containers, and the `docker start` command does not create new containers, so running it multiple times will not add additional entries to the `ps` output. Instead, what the `start` is doing is taking a non-running container and running it. The same would happen automatically with a restart policy on the container. The status in the `ps` output is the most recent status. Starting the container changes that status, as does stopping the container.
  
  To create a new container that would be listed in `ps`, that's `docker container create`, or just `docker create`, which makes the container without starting it. Typically, people just use `docker run` which is a combination of `docker create` and `docker start` to create new containers.
  
  > **Comments:**
  > **username_0**: Many thanks that really helped - so a non-running container can be restarted multiple times?  
  
  ---
  
  