How to restart the stopped docker/whalesay container?

As Docker for Mac getting started document instructed.

docker run docker/whalesay cowsay boo

  • Strategy for arangodb data backup in docker container
  • How to move docker network from old to new container?
  • Docker GitHub Automated Build Arguments
  • How can let docker use my network router to assign dhcp ip to containers easily instead of pipework?
  • Docker commands fail in Cygwin — Docker service is up
  • Redis in Docker container with custom redis.conf file not attaching
  • Every time, I run this, a new container is created, run and stopped.

    CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                         PORTS                         NAMES
    
    
    0d96e4bd9c14        docker/whalesay     "cowsay boo boo"         11 days ago         Exited (0) 5 minutes ago                                     high_archimedes
    3a079559382e        docker/whalesay     "cowsay boo"             11 days ago         Exited (0) 26 minutes ago                                    boring_ritchie
    

    How could I not create a new container of the docker/whalesay any more but restart existing stopped container of docker/whalesay and get the same result as

    docker run docker/whalesay cowsay boo

    ?

    I tried

    docker start 0d96e4bd9c14
    

    the result only shows

    0d96e4bd9c14
    

    Not the whale image as whalesay would show.

    Thanks!

  • sbt failed download in running play docker container
  • Performance of IBM Containers Volumes
  • 403 Forbidden - Nginx, Docker & Windows
  • Auto-completion for kubectl on CoreOS
  • Windows Containers - culture settings
  • Run Ruby script on Docker
  • 2 Solutions collect form web for “How to restart the stopped docker/whalesay container?”

    The container starts the second time but the difference is that you don’t see the stdout as a default with start

    For example:

    $ docker run docker/whalesay cowsay boo
    Unable to find image 'docker/whalesay:latest' locally
    latest: Pulling from docker/whalesay
    e9e06b06e14c: Pull complete 
    a82efea989f9: Pull complete 
    37bea4ee0c81: Pull complete 
    07f8e8c5e660: Pull complete 
    676c4a1897e6: Pull complete 
    5b74edbcaa5b: Pull complete 
    1722f41ddcb5: Pull complete 
    99da72cfe067: Pull complete 
    5d5bd9951e26: Pull complete 
    fb434121fc77: Already exists 
    Digest: sha256:178598e51a26abbc958b8a2e48825c90bc22e641de3d31e18aaf55f3258ba93b
    Status: Downloaded newer image for docker/whalesay:latest
     _____ 
    < boo >
     ----- 
        \
         \
          \     
                        ##        .            
                  ## ## ##       ==            
               ## ## ## ##      ===            
           /""""""""""""""""___/ ===        
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~   
           \______ o          __/            
            \    \        __/             
              \____\______/   
    $ 
    $ sudo docker ps
    CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
    $ sudo docker ps -a
    CONTAINER ID        IMAGE                    COMMAND             CREATED             STATUS                      PORTS               NAMES
    3230d1589aed        docker/whalesay:latest   "cowsay boo"        32 seconds ago      Exited (0) 31 seconds ago                       evil_curie          
    $ sudo docker start 3230d1589aed
    3230d1589aed
    

    Now check the STATUS that says Exited (0) 2 seconds ago:

    $ sudo docker ps -a
    CONTAINER ID        IMAGE                    COMMAND             CREATED             STATUS                     PORTS               NAMES
    3230d1589aed        docker/whalesay:latest   "cowsay boo"        46 seconds ago      Exited (0) 2 seconds ago                       evil_curie          
    

    You can see the output with docker logs:

    $ sudo docker logs 3230d1589aed
     _____ 
    < boo >
     ----- 
        \
         \
          \     
                        ##        .            
                  ## ## ##       ==            
               ## ## ## ##      ===            
           /""""""""""""""""___/ ===        
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~   
           \______ o          __/            
            \    \        __/             
              \____\______/   
     _____ 
    < boo >
     ----- 
        \
         \
          \     
                        ##        .            
                  ## ## ##       ==            
               ## ## ## ##      ===            
           /""""""""""""""""___/ ===        
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~   
           \______ o          __/            
            \    \        __/             
              \____\______/ 
    $ 
    

    You can create a new container that is interactive.

    docker run -ti –entrypoint=sh “imageID”

    Replace “imageID” with your image ID. Image IDs can be found by ‘docker images’ command.
    Then you can type a command (e.g., cowsay “say something”) in the prompt as many times as you want. You can exit by typing ‘exit’, it will stop the container. When you want to start the same container, you can start it by

    docker start -i “containerID”

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