redhat-developer / odo

odo - Developer-focused CLI for fast & iterative container-based application development on Podman and Kubernetes. Implementation of the open Devfile standard.
https://odo.dev
Apache License 2.0
795 stars 243 forks source link

docker volumes not deleted when `odo delete` is executed with PushTarget=docker #3235

Closed groeges closed 4 years ago

groeges commented 4 years ago

/kind bug

When the pushTarget preference is set to Docker, various docker volumes are created when an odo push is performed (if the devfile has volumes defined) for use within the docker containers. When an odo delete is performed the docker containers are deleted but the docker volumes are not deleted. This leaves these docker volumes laying around on the users machine.

There is no indication to the user that docker volumes have been created so they have no idea that these are left on their system and that they need to be cleaned up manually.

What versions of software are you using?

Operating System: Mac OS Output of odo version: odo v1.2.1 (b061f3434)

How did you run odo exactly?

odo preference set pushTarget docker odo create ... odo push odo delete

Actual behavior

even after odo delete there are still docker volumes existing

local               odo-project-source-default-lfhw
local               stack-default-sode

Expected behavior

after odo delete would expect the system to be same as before the first odo push

Any logs, error output, etc?

johnmcollier commented 4 years ago

Those should be cleaned up automatically by odo delete.

I can't reproduce 😕

Johns-MacBook-Pro-3:springdocker johncollier$ docker volume ls
DRIVER              VOLUME NAME
local               odo-project-source-java-spring-boot-bmgs
local               odo-supervisord-shared-data-vol-fspy
local               springbootpvc-java-spring-boot-qnkc
Johns-MacBook-Pro-3:springdocker johncollier$ odo delete
? Are you sure you want to delete the devfile component: java-spring-boot? (y/N)? Are you sure you want to delete the devfile component: java-spring-boot? Yes
 ✓  Deleting devfile component java-spring-boot [860ms]
 ✓  Successfully deleted component
Johns-MacBook-Pro-3:springdocker johncollier$ docker volume ls
DRIVER              VOLUME NAME
local               odo-supervisord-shared-data-vol-fspy

@jgwest thoughts?

groeges commented 4 years ago

@johnmcollier OK, thanks for trying to recreate. Let me try this again. It may be something specific to the devfile I am using. Will try another devfile and see if that cleans up the volumes correctly as part of the 'odo delete'

jgwest commented 4 years ago

I was likewise unable to reproduce using a Node.js devfile... @groeges let me know how it goes and if you have a devfile that reproduces the issue.

Now, like @johnmcollier, I do see odo-supervisord-shared-data-vol-(...) left behind... I'm not sure if that would be the responsibility of odo delete to clean up, and if not, whose it would be. That volume is not component-scoped like all the other volumes, but OTOH if it's not delete's responsibility then I'm not sure who else would handle it...

/assign

groeges commented 4 years ago

Think I may have had some old volumes laying around that were not getting deleted. I cleaned everything up and did a new odo push, checked volumes that were created, then did odo delete and rechecked the volumes. In this case all the volumes relating to the container were deleted. Will close this issue.