Docker & orphaned volumes

What is the best way to get rid of orphaned Docker volumes?

I have written one liner that seems to be solving this problem. First lets check how many volumes there are in total:

root@quad:~# docker volume ls | wc -l

72 volumes. Quite a lot to be honest.

Then I run this to double check that it really does return valid data.

for vol in `docker volume ls -qf dangling=true`; do  docker volume inspect $vol | jq -r '.[] | .Mountpoint' | xargs ls ; done

and I get 52 lines like these:

ls: cannot access '/opt/docker/volumes/07a1d0711833af526d08809118ae880fce4d6c537d4246c2fc332fceca0cde9a/_data': No such file or directory
ls: cannot access '/opt/docker/volumes/0d88bab60c8f5023a22f3ff15b35ab585c66b476f2e6615db06f50fefb2bc970/_data': No such file or directory
ls: cannot access '/opt/docker/volumes/0e4e14e289b25a65d0ee597bc7810c6f09961d13a059293a357c425b46534f5a/_data': No such file or directory
ls: cannot access '/opt/docker/volumes/18c2481850150cab1c46b0bdc9178e959c05dd4a205a45510c20467c6b95e473/_data': No such file or directory
ls: cannot access '/opt/docker/volumes/2275d260b670d10d026f1be776a9d32b9a26e23d513cca63add039e9451e3454/_data': No such file or directory
ls: cannot access '/opt/docker/volumes/28252f4885f02615e33d1ed2fdc4b45ebb21d38b933457760090f9f3b68f4e09/_data': No such file or directory

which means that only 20 volumes are actually valid, rest of them point to nonexistent folders on the hard drive.

So, they can be easily removed by running

docker volume ls -qf dangling=true | | xargs -r docker volume rm

PacktPub is celebrating 10 years – get any eBook for $10

My favorite IT publisher Packt Publishing has prepared awesome sale! They are celebrating 10 years of providing great learning and information materials for IT professionals. They are offering all of their ebooks and videos at just $10 each, also you can buy as many copies as you like until July 5. Act quickly as there are only 2 days left until this promotion ends!

You can find more information under this link:

Alfresco and high CPU usage

I finally found a solution for the high CPU usage bug in Alfresco. I still don’t know why it happens but at least I know how to deal with it so it does not make the whole environment unusable.

So the problem can be described as high CPU usage peaks which happen every 15 seconds. Every 15 seconds (default value) SOLR is asking Alfresco if it should index new data,and even though there is nothing to index you can observe that at least one CPU core usage jumps to 100% for 2-4 seconds.

Solution is to recreate SOLR indexes and clear the cached models, you can do this like this:

rm -fr alfresco/alf_data/solr/archive
rm -fr alfresco/alf_data/solr/workspace
rm alfresco/alf_data/solr/archive-SpacesStore/alfrescoModels/*
rm alfresco/alf_data/solr/workspace-SpacesStore/alfrescoModels/*

(backup them just in case!)

Then restart the server and give it some time to reindex data. Depending on the repository size it can take even very long hours.

Then the issue should be gone!

New Stamper website.

A few days ago I have enabled the new Stamper website: A lot has changed but the most importantly Stamper demo is available live. You can actually see it for yourself!

There are two interesting places you can visit. First one is the Stamper Configurator, a new, separate from Alfresco, web application where you can configure Stamper. This application is using CMIS to access the repository (because all configuration objects are stored there). I have plans to support Nuxeo soon, some preliminary work has been done and it is looking promising! The Stamper Configurator is available here. Login credentials are admin/admin.

Second place is the Alfresco repository itself. You can log in there as admin/admin (by the way the repository is reinitialized every day so no damage can be done there! :-). There are a few PDF documents there as well as two simple Stamper configurations, the first one contains cover page and page layer and the second one just the page layer. To stamp a PDF file just use the Stamp document option in a document’s context menu.

I will be also attending the Alfresco DevCon 2011 in London in November, I hope that this will be a good place to chat about Alfresco, Stamper and other interesting topics. Fell free to ask questions!


Groovy is great!

It is not only great mix of useful and convenient language constructs of Python, Ruby and other languages but it also turned out that it is a very good code obfuscator 🙂 Here is an example, code below:

    public static IDfSession getSession(String user,
        String password, String docbase) throws DfException {

        IDfClientX clientx = new DfClientX();
        IDfClient client = clientx.getLocalClient();
        IDfLoginInfo li = new DfLoginInfo();
        return client.newSession(docbase, li);

was translated to:

    public static IDfSession getSession(String user, String password, String docbase)
        throws DfException
        CallSite acallsite[] = $getCallSiteArray(); clientx = (( (acallsite[0].callConstructor($get$$class$com$documentum$com$DfClientX())));
        IDfClient client = (IDfClient)ScriptBytecodeAdapter.castToType(acallsite[1].call(clientx), $get$$class$com$documentum$fc$client$IDfClient());
        com.documentum.fc.common.IDfLoginInfo li = ((com.documentum.fc.common.IDfLoginInfo) (acallsite[2].callConstructor($get$$class$com$documentum$fc$common$DfLoginInfo())));
        acallsite[3].call(li, user);
        acallsite[4].call(li, password);
        return (IDfSession)ScriptBytecodeAdapter.castToType(acallsite[5].call(client, docbase, li), $get$$class$com$documentum$fc$client$IDfSession());

Awesome 🙂

“Fix Groovy Imports” in NetBeans

I was very frustrated with the fact that the Groovy & Grails plugin for NetBeans does not have the “Fix Imports” functionality: the option in the menu is simply grayed out. I started looking into the issue (and the NetBeans code…) and it turned out that the feature is actually implemented, it is just incorrectly connected to the menu option.

In order to fix it you have to define a new shortcut which will call the”Fix Groovy Imports” function. Just navigate to Tools/Options/Keymap and then change the shortcut as shown below:

That’s all 🙂