CentOS image is not running?

I downloaded centos base image executed in background as daemon and then tired to get in the terminal and couldn’t get in.

My Host is Ubuntu 16.04.

  • Kubernetes PetSet - FailedCreate of persistent volume
  • How to migrate existing tomcat application with Orcale database connection to Docker?
  • How persistent are docker data-only containers
  • docker restore; lack of indication to go-dockerclient - FIXED
  • Best practice using ALB
  • docker run complains file not found
  • Here are the steps I executed:

    Host OS Version Ubuntu16.04

     root@jim-Ubuntu1504:/home/jim/web# lsb_release -a No LSB modules are
     available. Distributor ID: Ubuntu Description:    Ubuntu 16.04 LTS
     Release:        16.04 Codename:       xenial
     root@jim-Ubuntu1504:/home/jim/web#
    

    Started docker by following commands

    root@jim-Ubuntu1504:/home/jim/web# docker run -d --name=my_centos centos
    Unable to find image 'centos:latest' locally
    latest: Pulling from library/centos
    a3ed95caeb02: Pull complete 
    da71393503ec: Pull complete 
    Digest: sha256:1a62cd7c773dd5c6cf08e2e28596f6fcc99bd97e38c9b324163e0da90ed27562
    Status: Downloaded newer image for centos:latest
    63f4b8fce1bd44253bb420436da3ad5b8f532b253fc9e74ff52ad1b2f9844251
    root@jim-Ubuntu1504:/home/jim/web# docker exec -i -t my_centos bash
    Error response from daemon: Container 63f4b8fce1bd44253bb420436da3ad5b8f532b253fc9e74ff52ad1b2f9844251 is not running
    

    No idea why it is exiting

    root@jim-Ubuntu1504:/home/jim/web# docker ps -a
    CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                      PORTS               NAMES
    63f4b8fce1bd        centos              "/bin/bash"              18 minutes ago      Exited (0) 18 minutes ago                       my_centos
    f0ca8b9f4fa5        nginx               "nginx -g 'daemon off"   23 minutes ago      Up 23 minutes               80/tcp, 443/tcp     my_nginxtemp
    bb9ab4958c33        nginx               "nginx -g 'daemon off"   About an hour ago   Up About an hour            80/tcp, 443/tcp     boring_aryabhata
    886d174f641d        nginx               "nginx -g 'daemon off"   2 hours ago         Up 2 hours                  80/tcp, 443/tcp     mad_fermat
    root@jim-Ubuntu1504:/home/jim/web# 
    

    Started the container but no idea why it is exiting

    root@jim-Ubuntu1504:/home/jim/web# docker start 63f4b8fce1bd
    63f4b8fce1bd
    root@jim-Ubuntu1504:/home/jim/web# docker ps -a
    CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                     PORTS               NAMES
    63f4b8fce1bd        centos              "/bin/bash"              26 minutes ago      Exited (0) 2 seconds ago                       my_centos
    f0ca8b9f4fa5        nginx               "nginx -g 'daemon off"   30 minutes ago      Up 30 minutes              80/tcp, 443/tcp     my_nginxtemp
    bb9ab4958c33        nginx               "nginx -g 'daemon off"   About an hour ago   Up About an hour           80/tcp, 443/tcp     boring_aryabhata
    886d174f641d        nginx               "nginx -g 'daemon off"   2 hours ago         Up 2 hours                 80/tcp, 443/tcp     mad_fermat
    root@jim-Ubuntu1504:/home/jim/web# docker exec -i -t my_centos bash
    Error response from daemon: Container 63f4b8fce1bd44253bb420436da3ad5b8f532b253fc9e74ff52ad1b2f9844251 is not running
    root@jim-Ubuntu1504:/home/jim/web# 
    

    PS: Can someone disable the restriction to post once every 90 mins ??? Learning has to be spontaneous and interactive.

  • how to create data volume from image for use in nginx container
  • Docker IPv6: Disable IPv4 in bridge docker0 and docker network
  • docker install fails with unmet dependencies on debian wheezy
  • Change .docker directory on Windows
  • ssh pseudo-tty causes PTY allocation request failed on channel 0
  • How to persist Rancher server meta data
  • One Solution collect form web for “CentOS image is not running?”

    if you look at the Dockerfile of the latest image of CentOS, you will notice the last line, from
    https://github.com/CentOS/sig-cloud-instance-images/blob/2ba488ba6746fe664fa849a1c78e3204b7d3c90e/docker/Dockerfile

    CMD ["/bin/bash"]

    so you launch a container that has a shell, it exists and that is all.

    try

    docker run -it --name=my_centos centos sleep infinity

    or any variant

    by the way, when you do

    root@jim-Ubuntu1504:/home/jim/web# docker exec -i -t my_centos bash

    you suppose that your container is running, which here, is not.

    Check with

    docker ps -a --filter="name=my_centos"

    that your container is up

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