Access your docker volumes via sftp!

Docker DNS is a python application you can use to
identify your containers by hostname or name.

You can run it with behind dnsmasq using the instructions

#sudo twistd dockerdns -u http://docker-server:5000 -p 53
# host mycontainer.docker # by container-name or hostname
172.17.0.12
# host mymage.*.docker # all container from a given image
172.17.0.12
172.17.0.13

Using twisted conch, I added sftp functionalities too, so you can access your container volumes directly.

#sftp -P10022 mycontainer@docker-server
sftp$ ls /
shared_volume1
shared_volume2

cx_oracle segfault by default

Playing with the twisted adbapi connecting to oracle. Stressing a bit the application (an sftp server authenticating on oracle) I found that when the connection pool is exhausted the application crashed.

The (simple) solution is to instantiate the pool with the threaded keyword.

dbpool = adbapi.ConnectionPool("cx_Oracle", 
  uri, 
  threaded=True  )

Twisted is an event-based framework: all the blocking calls should be done outside the listening thread. The a(synchronous)dbapi provide separate threads for db connections. Using cx_oracle in a non thread-safe way is a reasonable cause of segfault.

So checking cx_Oracle docs we found that thread safety is off by default to gain some performance.