Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Typically on a server, automatic updates of security-related patches are configured. Therefore, if I'm running MySQL 5.5 and a new security patch comes out, Ubuntu Server will apply the upgrade and restart MySQL to keep me protected in an automated way. Obviously, this can be disabled, but it's helpful for those of us who are a bit lazy ;)

Does such a concept exist inside of a Docker container? If I'm running MySQL in a Docker container, do I need to constantly stop the container, open a shell in it, then update and upgrade MySQL?

share|improve this question
    
This is Docker, and not LXC question. As LXC containers themselves are just another linux distribution running under same kernel, you would just use same commands to update the LXC container system. –  edvinas.me May 5 at 17:34

1 Answer 1

up vote 3 down vote accepted

TL;DR: If you don't build it in yourself, it's not going to happen.

The effective way to do this is to simply write a custom start script for your container specified by CMD in your Dockerfile. In this file, run an apt-get update && apt-get upgrade -qqy before starting whatever you're running.

You then have a couple way of ensuring updates get to the container:

  1. Define a cron job in your host OS to restart the container on a schedule, thus having it update and upgrade on a schedule.
  2. Subscribe to security updates to the pieces of software, then on update of an affected package, restart the container.

It's not the easiest thing to optimize and automate, but it's possible.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.