Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rock-on UI fails to reflect removed container #1795

Closed
phillxnet opened this issue Aug 12, 2017 · 3 comments
Closed

rock-on UI fails to reflect removed container #1795

phillxnet opened this issue Aug 12, 2017 · 3 comments
Assignees

Comments

@phillxnet
Copy link
Member

phillxnet commented Aug 12, 2017

Thanks to forum member absentbri for highlighting this issue. When a container is removed via command line the installed status of that container is not reflected in the UI. It is further proposed that the Web-UI uninstall procedure attempts to remove the image if it is found as well as attempting to remove the container: this leads to a cleaner re-installation of the same rock-on and some images, such as linuxserver.io's plex server (when no plex.tv account is associated), fail to fetch the latest version with the existing mechanism as the prior image is simply re-used rather than being re-downloaded/refreshed.

Steps to reproduce this issue:

Install HTTP to HTTPS redirect rockon

docker ps # to list the instance
CONTAINER ID        IMAGE                   COMMAND              CREATED             STATUS              PORTS                NAMES
dbc07c961b0d        geldim/https-redirect   "/bin/sh -c nginx"   7 minutes ago       Up 7 minutes        0.0.0.0:80->80/tcp   redirect-http-to-https

and it's associated image:

docker images
REPOSITORY              TAG                 IMAGE ID           ...
geldim/https-redirect   latest              ccf561ed3790        ...

Turn off rock-on in UI and we have only the image and no running container instance of that image: as expected.

docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

docker ps -a
CONTAINER ID        IMAGE                   COMMAND              CREATED             STATUS                       PORTS               NAMES
dbc07c961b0d        geldim/https-redirect   "/bin/sh -c nginx"   12 minutes ago      Exited (137) 2 minutes ago                       redirect-http-to-https

When the now off state Rockon is Uninstalled via the Web-UI the non running container instance is successfully removed:

docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

but the image remains:

docker images
REPOSITORY              TAG                 IMAGE ID           ...
geldim/https-redirect   latest              ccf561ed3790        ...

As per current behaviour.

But if we reinstall this same rock-on and then turn it off (as the default to being on); but this time we remove the now non running container instance from underneath Rockstor (ie via the command line):

docker ps -a
CONTAINER ID        IMAGE                   COMMAND              CREATED             STATUS                        PORTS               NAMES
dcb3fb3c8475        geldim/https-redirect   "/bin/sh -c nginx"   3 minutes ago       Exited (137) 20 seconds ago                       redirect-http-to-https

docker rm dcb3fb3c8475
dcb3fb3c8475

docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

refreshing the rock-ons Web-UI does not reflect the above removal / uninstall via command line.
And we have the following log report:

[12/Aug/2017 13:55:18] ERROR [storageadmin.views.rockon_utils:49] Error running a command. cmd = /usr/bin/docker inspect -f {{range $key, $value := .State}}{{$key}}:{{$value}},{{ end }} redirect-http-to-https. rc = 1. stdout = ['', '']. stderr = ['Error: No such object: redirect-http-to-https', '']
Traceback (most recent call last):
  File "/opt/rockstor-dev/src/rockstor/storageadmin/views/rockon_utils.py", line 31, in container_status
    '{{range $key, $value := .State}}{{$key}}:{{$value}},{{ end }}', name])  # noqa E501
  File "/opt/rockstor-dev/src/rockstor/system/osi.py", line 119, in run_command
    raise CommandException(cmd, out, err, rc)
CommandException: Error running a command. cmd = /usr/bin/docker inspect -f {{range $key, $value := .State}}{{$key}}:{{$value}},{{ end }} redirect-http-to-https. rc = 1. stdout = ['', '']. stderr = ['Error: No such object: redirect-http-to-https', '']

indicating the expected rock-on container is no longer found but it's UI / db component remains.

It is proposed that this is Buggy behaviour.

The now non existent but still showing in Web-UI rock-on can however still be successfully removed via the Uninstall button.

But as indicated earlier the image remains.

docker images
REPOSITORY              TAG                 IMAGE ID           ...
geldim/https-redirect   latest              ccf561ed3790        ...

Ready for comment on the best practice re image removal upon Uninstall.

Please update the following forum thread with this issues resolution:
https://forum.rockstor.com/t/no-end-of-trouble-with-rockons/3643

@magicalyak
Copy link
Contributor

I've hit this issue numerous times

@schakrava
Copy link
Member

Nice catch guys, I apologize for the sloppy implementation in the first place. Should be easy fix.

@schakrava schakrava self-assigned this Sep 5, 2017
@schakrava schakrava added this to the After Six milestone Sep 5, 2017
@schakrava
Copy link
Member

Ok, I've debugged this issue today and it turned out to be more than what I thought. A few observations

  1. It's ok not to delete docker images associated with a Rock-on when it's uninstalled. Instead, while installing, we should add an explicit pull of an image before running a container. This will ensure image updates are pulled, if any, during re-installs

  2. The log message from rockon_utils, where it's trying to inspect a container even if it's been removed manually, is just that. A log message and after some time, the state is updated automatically.

  3. If a rock-on root is deleted, it does delete all the operational state and deletes all docker bits barring any btrfs hiccups. But our administrative(db) state is outdated and does not get updated automatically. It does however can be cleaned up by manually uninstalling each rock-on. Certainly not ideal behaviour.

I'll open a pr with some improvements, but please comment if you have any thoughts on this.

schakrava added a commit to schakrava/rockstor-core that referenced this issue Sep 17, 2017
schakrava added a commit that referenced this issue Sep 17, 2017
explicitly pull an image to get potential updates. Fixes #1795
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants