Docker commands to clean unused images

If you use docker for some time, there will be a lot of trash images, volumes that is not used by any containers. Here’s how to remove them. (warning: not reversible)

Remove dangling images

Remove dangling volumes

As seen from above commands, you may guess the nested command within the $(…) is used to list dangling images/volumes

List dangling images

List dangling volumes

Using Dotenv config in Makefile (or anything)

Ever want to use .env file config directly in Makefile? I found it not as easy as it sounds. I found this shell command on the web Continue reading “Using Dotenv config in Makefile (or anything)”

Make Docker work with iptables

Docker containers are just like a computer, the networking between host and containers is affected by the firewall. My iptables has a default DROP all policy, but it will make the Containers cannot communicate with the host. Here is the fix you’ll need. Continue reading “Make Docker work with iptables”

Docker named volume explained

Named volume is a new feature since Docker 1.9, it allows you to manage persistent data more easily, and also the volume can be provided by other storage drivers such as Glusterfs instead of “just a directory on the host”. This new feature is particularly useful in production environment. (On the Dev side, I think we still need mounted volume) Continue reading “Docker named volume explained”