Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

Don't automatically create -data containers #260

Open
wallrj opened this issue Aug 19, 2014 · 1 comment
Open

Don't automatically create -data containers #260

wallrj opened this issue Aug 19, 2014 · 1 comment

Comments

@wallrj
Copy link
Contributor

wallrj commented Aug 19, 2014

gear install creates a -data container for each of its units if one doesn't already exist.

It would be tidier if gear only used the --volumes-from argument if a -data container was found.

This would avoid leaving behind unused -data containers when stateless units are deleted.

Not sure if it's possible to do such a test in the systemd service file, but perhaps the service files would be cleaner if they called a gear wrapper script to launch docker containers and move the various container tests into that script.

See

$ sudo gear install openshift/busybox-http-app:latest my-unit

$ sudo gear list-units -a
ID      SERVER  ACTIVE  SUB     LOAD    TYPE
my-unit         active  running loaded  

$ docker ps -a
CONTAINER ID        IMAGE                               COMMAND                CREATED             STATUS                   PORTS               NAMES
a8360222d9a0        openshift/busybox-http-app:latest   /opt/sti/run           2 hours ago         Up 2 hours               8080/tcp            my-unit             
bed17b6bf149        openshift/busybox-http-app:latest   /bin/true /opt/sti/r   2 hours ago         Exited (0) 2 hours ago                       my-unit-data  

$ sudo gear stop my-unit
Aug 19 05:58:00 localhost.localdomain systemd[1]: Stopping Container my-unit...
Aug 19 05:58:00 localhost.localdomain docker[17573]: my-unit
alter_container_state: Stop job done
journal: Done
Container my-unit is stopped

$ docker ps -a
CONTAINER ID        IMAGE                               COMMAND                CREATED             STATUS                   PORTS               NAMES
bed17b6bf149        openshift/busybox-http-app:latest   /bin/true /opt/sti/r   2 hours ago         Exited (0) 2 hours ago                       my-unit-data        

$ sudo gear delete my-unit
Deleted my-unit

$ docker ps -a
CONTAINER ID        IMAGE                               COMMAND                CREATED             STATUS                   PORTS               NAMES
bed17b6bf149        openshift/busybox-http-app:latest   /bin/true /opt/sti/r   2 hours ago         Exited (0) 2 hours ago                       my-unit-data       

$ sudo gear clean
INFO: 2014/08/19 05:59:54 --- "FAILED CONTAINERS" CLEANUP ---
INFO: 2014/08/19 05:59:54 --- HOME DIRECTORY REPAIR ---
INFO: 2014/08/19 05:59:54 --- PORTS CLEANUP ---

$ docker ps -a
CONTAINER ID        IMAGE                               COMMAND                CREATED             STATUS                   PORTS               NAMES
bed17b6bf149        openshift/busybox-http-app:latest   /bin/true /opt/sti/r   2 hours ago         Exited (0) 2 hours ago                       my-unit-data        

@smarterclayton
Copy link
Contributor

I had started down this road in #198 - providing a better wrapper. I don't think there's much left to bring it up to speed - the isolation mode was problematic for various reasons (would be better prototyped in Docker directly), but the rest was working.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants