tags: Docker

Docker Containers Without a Proper Init Process May Take a Long Time to Terminate

When stopping a container one way or another, like by Ctrl+C or docker stop, Docker sends SIGTERM to the process by default. If the first process (PID = 1) on the container is not a proper init process, the termination may take a long time to be done. It's because processes running as PID 1 are treated differently than usual ones. In Linux, a process running as PID 1 ignores any signal unless the process implements signal handlers on its own.

Read more →

Variables with Shell-Style Default in docker-compose.yml

Today I learned that in docker-compose.yml, a variable interpolation with a default can be expressed as ${VAR1:-default value} like shell-style parameter expansion. With parameter expansion, you can do more than setting a default value such as modifying the parameter. However, the supported features in docker-compose.yml are limited to two of them: to set a default variable or to make the parameter mandatory. Let's define VAR_ALPHA with a default value for the example service.

Read more →

Kind: Kubernetes in Docker

While I was playing with act the other day, I found a tool called kind (Kubernetes in Docker) in that repository. With kind, Kubernetes clusters can easily be created in a Docker container. According to the official document, being an alternative to Docker Compose out of scope for kind. That said, the home page also suggests kind may be used for “local development”. kind was primarily designed for testing Kubernetes itself, but may be used for local development or CI.

Read more →

Setting Up GitHub Actions Locally and Quickly

In software development, a feedback loop that takes time and effort could be a major bottleneck. Especially if we have to run things on remote servers and figuring out what's going on requires lots of effort, debugging could make frustrations. Today, I'm going to introduce a couple of tools that help to debug GitHub Actions workflows from local machines. Act With act command, you can run workflows on your local machine.

Read more →

A Quick Way to Try Stripe Subscriptions With Docker

Stripe provides an easy way to implement subscription services. This document explains how Stripe's subscription works and the things you can. They also provide an example to implement fixed-price subscriptions, like Netflix. You can try the example repository on GitHub and see the whole lifecycle of a subscription. Actually, you don't have to even set up any environment for the example app if you have Docker on your computer. The only dependency is Docker.

Read more →

Using Docker for RubyGems projects

Sometimes I want to create a new gem or modify existing gems to extend/fix them. However, I do not want to install tons of additional development tools on my host machine for that. Recently, I created a shell script which creates an instant development environment on Docker for that. #!/bin/sh -e exec docker run --rm -it \ --workdir=/work \ -v $(pwd):/work \ -v=$HOME/.gitconfig:/root/.gitconfig \ -v=$HOME/.ssh:/root/.ssh \ -v=$HOME/.

Read more →

Running Desktop Applications on Containers

Docker is an important tool for running web applications in both production and development environments nowadays. Actually, it can also be used for running desktop applications. That means you can take advantage of Docker's mobility even on the desktop. However, there are some tricks to make that work well. In short, you have to enable applications inside containers to use some resources on the host machine. Using X11 via Unix Socket As you may know, X11 originally supports remote use and it can be accessed via TCP or Unix Domain sockets.

Read more →

Why You Need a Proper Init Process on Docker

You have to use proper init process when you create a docker image. Running a process on docker without it might lead unexpected results. Today, I'll explain about that. The “init” Process and Orphans On a Linux system, the process which has PID 1 is the root of the process tree. It is called “init”. The default signal handlers of the init process is different from other ordinary processes. And the init process has a special responsibility.

Read more →

Gentaro "hibariya" Terada

Otaka-no-mori, Chiba, Japan
Email me

Likes Ruby, Internet, and Programming.