Docker container not starting with ubuntu image docker start

0 votes

If I use docker container run ubuntu to run a container directly from an Ubuntu image, I can easily restart it using docker start CONTAINER_ID. When I run the container using the image using docker run ID_IMAGE, however, it is completely gone as I quit the pseudo-terminal.

When I tried to restart it, I observed that the status changed, indicating that the primary process starts and then ends. Do you have any ideas?

portaivan@training-vm:~$ docker image ls -a
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
ubuntu              latest              d70eaf7277ea        8 days ago          72.9MB
portaivan@training-vm:~$ docker container ls -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                      PORTS               NAMES
4004895feff9        d70eaf7277ea        "/bin/bash"         3 hours ago         Exited (0) 3 hours ago                          heuristic_lovelace
3b1b521d62aa        ubuntu              "/bin/bash"         3 hours ago         Exited (0) 23 seconds ago                       sleepy_pike
portaivan@training-vm:~$ docker start 3b1b521d62aa
3b1b521d62aa
portaivan@training-vm:~$ docker container ls -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                   PORTS               NAMES
4004895feff9        d70eaf7277ea        "/bin/bash"         3 hours ago         Exited (0) 3 hours ago                       heuristic_lovelace
3b1b521d62aa        ubuntu              "/bin/bash"         3 hours ago         Up 2 seconds                                 sleepy_pike
portaivan@training-vm:~$ docker container start 4004895feff9
4004895feff9
portaivan@training-vm:~$ docker container ls -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                     PORTS               NAMES
4004895feff9        d70eaf7277ea        "/bin/bash"         3 hours ago         Exited (0) 2 seconds ago                       heuristic_lovelace
3b1b521d62aa        ubuntu              "/bin/bash"         3 hours ago         Up 17 seconds                                  sleepy_pike
portaivan@training-vm:~$ docker container start -i 4004895feff9
portaivan@training-vm:~$ docker container ls -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                     PORTS               NAMES
4004895feff9        d70eaf7277ea        "/bin/bash"         3 hours ago         Exited (0) 2 seconds ago                       heuristic_lovelace
3b1b521d62aa        ubuntu              "/bin/bash"         3 hours ago         Up 28 seconds                                  sleepy_pike
Apr 30, 2022 in Docker by Abhijeet
• 180 points

edited 4 days ago 3 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP