Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dockerTools.buildImage: support impure dates #47005

Merged

Commits on Sep 20, 2018

  1. 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
    graham-at-target committed Sep 20, 2018
    Configuration menu
    Copy the full SHA
    19e82bb View commit details
    Browse the repository at this point in the history