thisendout / cyclops

Docker-powered REPL for scripting and automation
MIT License
9 stars 3 forks source link

How should cyclops interact with the image cache? #41

Open cllunsford opened 9 years ago

cllunsford commented 9 years ago

Currently, layers generated by cyclops aren't used by other builds, due to differences in the resulting container config:

    "ContainerConfig": {                        "ContainerConfig": {
        "Hostname": "dd360632d03c",               |         "Hostname": "f56ae10d5429",
        "Domainname": "",                           "Domainname": "",
        "User": "",                             "User": "",
        "AttachStdin": false,                           "AttachStdin": false,
        "AttachStdout": false,                          "AttachStdout": false,
        "AttachStderr": false,                          "AttachStderr": false,
        "PortSpecs": null,                          "PortSpecs": null,
        "ExposedPorts": null,                           "ExposedPorts": null,
        "Tty": false,                               "Tty": false,
        "OpenStdin": false,                         "OpenStdin": false,
        "StdinOnce": false,                         "StdinOnce": false,
        "Env": [                          |         "Env": null,
            "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/u <
        ],                            <
        "Cmd": [                                "Cmd": [
            "/bin/sh",                        |             "/bin/bash",
            "-c",                                   "-c",
            "mkdir -p /tmp/bar"                             "mkdir -p /tmp/bar"
        ],                                  ],
        "Image": "d2a0ecffe6fa4ef3de9646a75cc629bbd9da7eead7f |         "Image": "ubuntu:trusty",
        "Volumes": null,                            "Volumes": null,
        "VolumeDriver": "",                         "VolumeDriver": "",
        "WorkingDir": "",                           "WorkingDir": "",
        "Entrypoint": null,                         "Entrypoint": null,
        "NetworkDisabled": false,                       "NetworkDisabled": false,
        "MacAddress": "",                           "MacAddress": "",
        "OnBuild": [],                        |         "OnBuild": null,
        "Labels": {}                                "Labels": {}

Also, does it make sense for cyclops to use layers already in the cache? Switching cyclops to use a docker build call instead of docker run would speed up the build at the cost of aggressive cache usage.

cllunsford commented 9 years ago

Looking at docker source, the Env and Cmd differences are what drive the cache miss. OnBuild, Image, and Hostname are not checked for equality.