From a32d7e0c74465e685c997624b12d1582fda05fd9 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Thu, 20 Sep 2018 11:40:36 -0400 Subject: dockerTools.buildImage: support impure dates Because dates are an impurity, by default buildImage will use a static date of one second past the UNIX Epoch. This can be a bit frustrating when listing docker images in the CLI: $ docker image list REPOSITORY TAG IMAGE ID CREATED SIZE hello latest 08c791c7846e 48 years ago 25.2MB If you want to trade the purity for a better user experience, you can set created to now. pkgs.dockerTools.buildImage { name = "hello"; tag = "latest"; created = "now"; contents = pkgs.hello; config.Cmd = [ "/bin/hello" ]; } and now the Docker CLI will display a reasonable date and sort the images as expected: $ docker image list REPOSITORY TAG IMAGE ID CREATED SIZE hello latest de2bf4786de6 About a minute ago 25.2MB --- doc/functions.xml | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'doc/functions.xml') diff --git a/doc/functions.xml b/doc/functions.xml index 3cfc6884bd26..31b40fb084a3 100644 --- a/doc/functions.xml +++ b/doc/functions.xml @@ -638,6 +638,45 @@ buildImage { pkgs.cacert to contents. + + + Impurely Defining a Docker Layer's Creation Date + + Because dates are an impurity, by default + buildImage will use a static date of one + second past the UNIX Epoch. This can be a bit frustrating when + listing docker images in the CLI: + + + + If you want to trade the purity for a better user experience, + you can set created to + now. + + + + and now the Docker CLI will display a reasonable date and + sort the images as expected: + + +
-- cgit v1.2.3