0

On Ubuntu's fresh server with pre-installed Docker, When the server boots, the "docker images" command displays erichough/kodi image.

$ sudo docker images -a
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
erichough/kodi      latest              ede3f836a76c        5 weeks ago         554MB

The "docker ps" command displays no ps.

$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
$

But in this moment there is "gitlab/gitlab-ce" running container that i can use it's services. The sudo docker container ls -a command sho:

CONTAINER ID        IMAGE                     COMMAND                  CREATED             STATUS                                 PORTS                                                                  NAMES
0026317ebf3a        gitlab/gitlab-ce:latest   "/assets/wrapper"        3 hours ago         Up About a minute (health: starting)   0.0.0.0:80->80/tcp, 0.0.0.0:99->99/tcp, 22/tcp, 0.0.0.0:443->443/tcp   mygit
3bd3725ac1c1        gitlab/gitlab-ce:latest   "/assets/wrapper"        47 hours ago        Created                                                                                                       gitlab
4ccc43a8f047        cozy/full                 "/usr/local/bin/supe…"   6 days ago          Created                                                                                                       confident_varahamihira
a50451e519a1        cozy/full                 "/usr/local/bin/supe…"   6 days ago          Created                                                                                                       sharp_curran
76fbaf259b4c        cozy/full                 "/usr/local/bin/supe…"   6 days ago          Created                                                                                                       quirky_bassi
c48667761038        cozy/full                 "/usr/local/bin/supe…"   6 days ago          Created                                                                                                       frosty_lederberg
218a7ce0bcd3        cozy/full                 "/usr/local/bin/supe…"   6 days ago          Exited (255) 6 days ago                0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp                               peaceful_edison

When I restart the Docker service, the list of images changes.

$ sudo systemctl restart docker
$



$ sudo docker images -a
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
gitlab/gitlab-ce    latest              e6b464b98aff        10 days ago         1.92GB
cozy/full           latest              6579394e9b4f        2 years ago         1.25GB
$ sudo docker ps
CONTAINER ID        IMAGE                     COMMAND             CREATED             STATUS                                 PORTS                                                                  NAMES
bba08cdc44ee        gitlab/gitlab-ce:latest   "/assets/wrapper"   42 hours ago        Up About a minute (health: starting)   0.0.0.0:80->80/tcp, 0.0.0.0:99->99/tcp, 22/tcp, 0.0.0.0:443->443/tcp   mygit

In this new list, I can see image of container that was running in the past. Why did this happen and how can I merge the two lists?

  • What does docker container ls -a show before the restart? – BMitch Apr 11 '20 at 19:21
  • Also include the output of docker container inspect bba08cdc44ee – BMitch Apr 11 '20 at 19:22
  • I remove bba08cdc44ee ps befor your comment. The question edited and answer of "What does docker container ls -a show before the restart?" does add. – mohammad bagher Malekhosseini Apr 11 '20 at 19:43
  • Answer of "Also include the output of docker container inspect bba08cdc44ee " is: Error: No such container: bba08cdc44ee – mohammad bagher Malekhosseini Apr 11 '20 at 19:45
0

It appears you've deleted the evidence of what happened, but most likely the container was stopped (it would have appeared in a docker container ls -a which includes stopped containers in addition to running ones). If the container is configured to restart automatically, which would appear in the inspect output, then restarting the docker engine would restart the container. If the image is not available to run the container, then it's conceivable that docker would download it again, though I'm surprised you would have been able to delete the image while a container was defined, docker should prevent that.

The other possibility is some other tool is configured to deploy the container, and that tool was started when you restarted docker. That could include an orchestration tool like Swarm Mode or Kubernetes.

  • I don't remove any image. I use this command: sudo docker stop bba08cdc44ee and then sudo docker rm bba08cdc44ee and then restart the computer. after boot everything was the same as before. I don't know any thing about Swarm Mode or Kubernetes. – mohammad bagher Malekhosseini Apr 11 '20 at 20:06
  • @mohammadbagherMalekhosseini with the container deleted and no ability to run further debugging in the past, there's no easy way to assist. I'm confused how you had the image ls output from before you restarted the computer unless you expected this and can recreate the issue. – BMitch Apr 11 '20 at 20:12
  • Thank you @BMitch. I learned a lot. – mohammad bagher Malekhosseini Apr 12 '20 at 18:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.