Skip to content

Instantly share code, notes, and snippets.

@mauilion
Created June 12, 2018 20:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mauilion/2ae17ad1b90caff6374e1fee30dbe9eb to your computer and use it in GitHub Desktop.
Save mauilion/2ae17ad1b90caff6374e1fee30dbe9eb to your computer and use it in GitHub Desktop.

Torcx requires three things to operate.

  1. /etc/torcx/next-profile
    • This contains the word "docker" and is a pointer to the profile name below.
  2. /etc/torcx/profiles/docker.json
    • This is the name of a profile with the following content:
{
    "kind": "profile-manifest-v0",
    "value": {
        "images": [
            {
                "name": "docker",      #the object in /var/lib/torcx/store/
                "reference": "17.03"   #The version of thing to install (also referencing the object)
            }
        ]
    }
}
  1. /var/lib/torcx/store/docker:17.03.torcx.tgz
    • This is the torcx "pkg" to install.

you can pull the available images from a coreos node

core@core-01 ~ $ . /etc/lsb-release
core@core-01 ~ $ curl https://tectonic-torcx.release.core-os.net/manifests/amd64-usr/${DISTRIB_RELEASE}/torcx_manifest.json
{
  "kind": "torcx-package-list-v0",
  "value": {
    "packages": [
      {
        "name": "docker",
        "versions": [
          {
            "version": "1.12",
            "hash": "sha512-2ff11d91e285a831178219eddd6147e98df78162d94a98a5c1e560af053a2260122a7ce6aa661d2fa8768b9f348c2e56422caad48633c1c12a7b870bf2b61989",
            "casDigest": "2ff11d91e285a831178219eddd6147e98df78162d94a98a5c1e560af053a2260122a7ce6aa661d2fa8768b9f348c2e56422caad48633c1c12a7b870bf2b61989",
            "sourcePackage": "app-emulation/docker-1.12.6-r8",
            "locations": [
              {
                "path": "/usr/share/torcx/store/docker:1.12.torcx.tgz"
              },
              {
                "url": "https://tectonic-torcx.release.core-os.net/pkgs/amd64-usr/docker/2ff11d91e285a831178219eddd6147e98df78162d94a98a5c1e560af053a2260122a7ce6aa661d2fa8768b9f348c2e56422caad48633c1c12a7b870bf2b61989/docker:1.12.torcx.tgz"
              }
            ]
          },
          {
            "version": "18.03",
            "hash": "sha512-c15aa8377ca63b13559933ab2663bf1db5972d00d44dacc0842755f4f7fc7ed27801a32bd16340f3c6c1c47012134d6c7b708e8de130f68961f425da9be913bf",
            "casDigest": "c15aa8377ca63b13559933ab2663bf1db5972d00d44dacc0842755f4f7fc7ed27801a32bd16340f3c6c1c47012134d6c7b708e8de130f68961f425da9be913bf",
            "sourcePackage": "app-emulation/docker-18.03.1",
            "locations": [
              {
                "path": "/usr/share/torcx/store/docker:18.03.torcx.tgz"
              },
              {
                "url": "https://tectonic-torcx.release.core-os.net/pkgs/amd64-usr/docker/c15aa8377ca63b13559933ab2663bf1db5972d00d44dacc0842755f4f7fc7ed27801a32bd16340f3c6c1c47012134d6c7b708e8de130f68961f425da9be913bf/docker:18.03.torcx.tgz"
              }
            ]
          },
          {
            "version": "17.03",
            "hash": "sha512-7ed8024f8352c51aac86c9ecfad2c1133caf72fab7e42e120896c1d9b7842f490fe28be1f172f963891cbfa533cc3f3ec0df576b6fc939b2eba258f5421ff41e",
            "casDigest": "7ed8024f8352c51aac86c9ecfad2c1133caf72fab7e42e120896c1d9b7842f490fe28be1f172f963891cbfa533cc3f3ec0df576b6fc939b2eba258f5421ff41e",
            "sourcePackage": "app-emulation/docker-17.03.2-r1",
            "locations": [
              {
                "url": "https://tectonic-torcx.release.core-os.net/pkgs/amd64-usr/docker/7ed8024f8352c51aac86c9ecfad2c1133caf72fab7e42e120896c1d9b7842f490fe28be1f172f963891cbfa533cc3f3ec0df576b6fc939b2eba258f5421ff41e/docker:17.03.torcx.tgz"
              }
            ]
          }
        ],
        "defaultVersion": "18.03"
      }
    ]
  }
}

Here is an example ignition blob for this:

{
  "ignition": { "version": "2.1.0" },
  "storage": {
    "files": [
      {
        "filesystem": "root",
        "path": "/etc/torcx/next-profile",
        "mode": 420,
        "contents": { "source": "data:,docker" }
      },
      {
        "filesystem": "root",
        "path": "/var/lib/torcx/store/docker:17.03.torcx.tgz",
        "mode": 420,
        "contents": {
          "source": "https://tectonic-torcx.release.core-os.net/pkgs/amd64-usr/docker/7ed8024f8352c51aac86c9ecfad2c1133caf72fab7e42e120896c1d9b7842f490fe28be1f172f963891cbfa533cc3f3ec0df576b6fc939b2eba258f5421ff41e/docker:17.03.torcx.tgz",
          "verification": { "hash": "sha512-7ed8024f8352c51aac86c9ecfad2c1133caf72fab7e42e120896c1d9b7842f490fe28be1f172f963891cbfa533cc3f3ec0df576b6fc939b2eba258f5421ff41e" }
        }
      },
      {
        "filesystem": "root",
        "path": "/etc/torcx/profiles/docker.json",
        "mode": 420,
        "contents": { "source": "data:,%7B%22kind%22%3A%22profile-manifest-v0%22%2C%22value%22%3A%7B%22images%22%3A%5B%7B%22name%22%3A%22docker%22%2C%22reference%22%3A%2217.03%22%7D%5D%7D%7D" }
      }
    ]
  }
}

This config assumes that we want to pin version 17.03 of docker regardless of what version of CL is operating.

This snippet was validated with coreos-vagrant: https://github.com/coreos/coreos-vagrant

I've run the following tests: Pulled the previous stable version of Container Linux and installed docker 17.03.2-ce with the above ignition snippet.

ran the update_engine_client --check-for-update triggering an update to the latest stable. Verified that the version of docker remained 17.03

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment