Skip to main content

Posts

Showing posts from January, 2018

Cache busting when building Docker images

One of the handiest features of the docker build system is the caching system. 'docker build' tries to reuse the layers already built until something changes inside the Dockerfile. In this way, we can save several minutes when rebuilding an image if the changes happen further down the list in the Dockerfile. Sometimes, though, we do want to invalidate the cache and ensure the next build won't use it. To do this an option is to pass the '--no-cache' argument to 'docker build'. When dealing with 'apt-get install' instructions though there are other tricks. I found this document on Dockerfile best practices very useful. First of all an observation. If you have 'RUN apt-get update' as a single line of a Dockerfile, followed by the installation of a package, e.g.: RUN apt-get update RUN apt-get install -y nginx then changing the list of packages and running again the build command won't trigger an 'apt-get update': that...

SIP - ACK loose routing

If you've ever worked with SIP, you must have stumbled upon a trace with 200 OK to INVITE being retransmitted for about 30" and then the call just being set up fail. The ACK was never received. Then comes the interesting part: discovering why. Here are some notes about what should happen, in particular when there are multiple proxies along the path, and with a little additional complexity of one of the proxies with two network interfaces. All this assuming loose routing everywhere. The main reference here of course is RFC 3261 . Isn't an image worth a thousand words? Then here's a sequence diagram: All Record-Route headers are assumed to carry loose routing URIs (they have the ;lr attribute). B, C and D, working as proxies that want to stay in the path, record route themselves. For this reason E, the UAS and "callee", receives an INVITE with a list of Record-Route headers with B, C and D. In particular for B there will be two Record-Route head...

Copying a file from a Docker container to the host

Often things are more convoluted than you expect. Sometimes they are easier than you fear. Here's an example: you're generating files inside a Docker container (with no volumes configured) and you realise you need some of those files available in the host. A simple solution is to use 'docker cp', with a format like docker cp CONTAINER_ID:FILE_PATH HOST_FILE_PATH Official documentation . A Stackoverflow question with more discussions .