[Nix-dev] docker import ignores dockerTools.buildImage config

Brian McKenna brian at brianmckenna.org
Mon Sep 26 12:13:21 CEST 2016


Yes, it's "docker load" instead of "docker import"

The escaping thing is due to jshon trying to support generating JSON
which can be inserted into a <script> tag. It adds a backslash so that
it never generates the string "</script>"

On 26/09/2016, Michael Fellinger <m.fellinger at gmail.com> wrote:
> Try using 'docker load -i' instead
>
> On Sun, Sep 25, 2016, 13:44 Tomasz Czyż <tomasz.czyz at gmail.com> wrote:
>
>> Hi,
>>
>> I'm preparing docker image using dockerTools.buildImage with
>>
>>       x = pkgs.dockerTools.buildImage {name="myimage";·
>>
>>         contents = [dumb-init ];
>>
>>         config={
>>
>>           WorkingDir = "/";
>>
>>         };
>>
>>      };
>>
>> After the image is ready I do
>>
>> docker import /nix/store/xxxxxx.tar.gz myimage
>> and I have the image imported but
>>
>> docker inspect myimage
>>
>>         "Config": {
>>             "Hostname": "",
>>             "Domainname": "",
>>             "User": "",
>>             "AttachStdin": false,
>>             "AttachStdout": false,
>>             "AttachStderr": false,
>>             "Tty": false,
>>             "OpenStdin": false,
>>             "StdinOnce": false,
>>             "Env": null,
>>             "Cmd": null,
>>             "Image": "",
>>             "Volumes": null,
>>             "WorkingDir": "",
>>             "Entrypoint": null,
>>             "OnBuild": null,
>>             "Labels": null
>>         },
>>
>> inside the tar file I have the config like:
>>
>> {
>>  "architecture": "amd64",
>>  "config": {
>>   "WorkingDir": "\/"
>>  },
>>  "created": "1970-01-01T00:00:01Z",
>>  "os": "linux",
>>  "checksum":
>> "tarsum.v1+sha256:41988742f842b9214b599674ccc7d3da9a0df5336276657cec1a9eabf1c297ef",
>>  "id":
>> "9edfe86ac62fc829c5a122778565e3af12ce720dd64ca6547c6664e671996c63",
>>  "Size": 22067200
>> }
>>
>> So as you can see, the json config is generated inside docker image, but
>> docker does not import that settings. Also it looks like it's escaped but
>> it should not be right?
>>
>> Does anyone knows how to do it properly or tell how I could fix it?
>> _______________________________________________
>> nix-dev mailing list
>> nix-dev at lists.science.uu.nl
>> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>>
>


More information about the nix-dev mailing list