Skip to content

Instantly share code, notes, and snippets.

@luebken
Last active March 23, 2016 21:12
Show Gist options
  • Select an option

  • Save luebken/ebe0243176e05c75c5f1 to your computer and use it in GitHub Desktop.

Select an option

Save luebken/ebe0243176e05c75c5f1 to your computer and use it in GitHub Desktop.
Getting Started With Atomic Host

There is this project out there projectatomic.io which provides a platform for running containers. And is an important part of the RHEL container story. Project atomic consists actually of several technologies this document looks at atomic host.

Atomic Host

Atomic Host is a lightweight, immutable platform, designed with the sole purpose of running containerized applications.

Currently Fedora, RHEL and CentOS offer an atomic host base release. The main technology atomic host build upon is OSTree.

OSTree

OSTree builds fully assembled, versioned filesystem trees that hold what would have gone into a set of package (e.g. RPM) files. All of the binaries, libraries, documentation files, and so on are gathered together into the OSTree repository and can be retrieved using the ostree command.

The underlying architecture might be summarized as "git for operating system binaries". It operates in userspace, and will work on top of any Linux filesystem.

Can work together with a file system like RPM. For example, when installing a package, rather than changing the currently running filesystem, the package manager could assemble a new filesystem tree that layers the new packages on top of a base tree, record it in the local OSTree repository, and then set it up for the next boot.

RPM-OSTree does just that it combines the OSTree with a set of RPMs.

Hands on

  # install a vagrant box with the fedora version
  $ vagrant init fedora/23-atomic-host; vagrant up --provider virtualbox
  $ vagrant ssh
  
  # upgrade to a new version
  $ sudo rpm-ostree upgrade
  Updating from: fedora-atomic:fedora-atomic/f23/x86_64/docker-host

  Receiving metadata objects: 0/(estimating) -/s 0 bytes
  Copying /etc changes: 24 modified, 0 removed, 72 added
  Transaction complete; bootconfig swap: no deployment count change: 0
  Freed objects: 19.6 MB
  Changed:
    bind99-libs 9.9.8-2.P3.fc23 -> 9.9.8-4.P4.fc23
    bind99-license 9.9.8-2.P3.fc23 -> 9.9.8-4.P4.fc23
    ca-certificates 2015.2.6-1.0.fc23 -> 2016.2.7-1.0.fc23
    cockpit-bridge 0.95-1.fc23 -> 0.96-1.fc23
    cockpit-docker 0.95-1.fc23 -> 0.96-1.fc23
    cockpit-networkmanager 0.95-1.fc23 -> 0.96-1.fc23
    cockpit-ostree 0.95-1.fc23 -> 0.96-1.fc23
  ...

  $ systemctl reboot

  # see which remote repostory ostree will be using
  $ cat /etc/ostree/remotes.d/fedora-atomic.conf
  [remote "fedora-atomic"]
  url=https://dl.fedoraproject.org/pub/fedora/linux/atomic/23/
  gpg-verify=false
  
  # see what versions are local available
  $ sudo rpm-ostree status
      TIMESTAMP (UTC)         VERSION   ID             OSNAME            REFSPEC
    2016-03-22 19:31:01     23.88     51f371aa3d     fedora-atomic     fedora-atomic:fedora-atomic/f23/x86_64/docker-host
  * 2016-03-07 03:45:47     23.79     1a68c7b9c0     fedora-atomic     fedora-atomic:fedora-atomic/f23/x86_64/docker-host

  # see what versions are remote available
  $ sudo ostree pull --depth=10 --commit-metadata-only fedora-atomic:fedora-atomic/f23/x86_64/docker-host
  $ sudo ostree log fedora-atomic:fedora-atomic/f23/x86_64/docker-host
  commit 51f371aa3d80ec1f6336daa4d5d1c310b0486d872d979a8e2d3b3435ccc3aa74
  Date:  2016-03-22 19:31:01 +0000
  Version: 23.88

  commit 77e95d3e160079aedaf201c3e5d9357ce464885b7d12566e014ad9157babdb99
  Date:  2016-03-21 23:44:55 +0000
  Version: 23.87

  commit 2cc5258799a57f91aba288ecf109cc6ed4f91d00bd58f9f29a214b612fb5ec09
  Date:  2016-03-20 02:12:22 +0000
  Version: 23.86

  ...
  
  # see what packages are in a particular version
  $ sudo rpm-ostree deploy 23.86 --preview
  Resolving version '23.86'
  Updating from: fedora-atomic:fedora-atomic/f23/x86_64/docker-host
  
  5 metadata, 19 content objects fetched; 5999 KiB transferred in 9 seconds
  !bind99-libs-9.9.8-2.P3.fc23-x86_64
  =bind99-libs-9.9.8-4.P4.fc23-x86_64
  !bind99-license-9.9.8-2.P3.fc23-noarch
  =bind99-license-9.9.8-4.P4.fc23-noarch
  !cockpit-bridge-0.95-1.fc23-x86_64
  =cockpit-bridge-0.96-1.fc23-x86_64
  !cockpit-docker-0.95-1.fc23-x86_64
  =cockpit-docker-0.96-1.fc23-x86_64
  !cockpit-networkmanager-0.95-1.fc23-noarch
  =cockpit-networkmanager-0.96-1.fc23-noarch
  !cockpit-ostree-0.95-1.fc23-x86_64
  =cockpit-ostree-0.96-1.fc23-x86_64
  !cockpit-shell-0.95-1.fc23-noarch
  
  # switch to a particluar version
  $ sudo rpm-ostree deploy 23.86

Links

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