Atomic Run Tool for installing/running/managing container images.
Python Shell JavaScript Go Makefile Other HTML
Latest commit add28f5 Jan 22, 2017 @baude baude committed with rh-atomic-bot Leverage skopeo inspect and inspect --raw
Remove discovery code and use skopeo where possible.

Closes: #846
Approved by: jlebon
Failed to load latest commit information.
Atomic Leverage skopeo inspect and inspect --raw Jan 23, 2017
atomic.d atomic.d/openscap: Fix race condition (bz #1368896) Oct 10, 2016
bash add trust reset command Jan 18, 2017
docs add trust reset command Jan 18, 2017
tests Leverage skopeo inspect and inspect --raw Jan 23, 2017
.gitignore Add more files to ignore Sep 1, 2016
.redhat-ci.Dockerfile .redhat-ci: test on multiple platforms Oct 26, 2016 Add fedora25_cloud target for vagrant Nov 30, 2016
.redhat-ci.yml redhat-ci: make testsuites required Dec 6, 2016 Bump to v1.15.1 Jan 17, 2017 New file Apr 7, 2016
COPYING COPYING: Use the LGPLv2+ to be more compatible with ASL 2.0 etc. Feb 19, 2015
LICENSE Symlink LICENSE -> COPYING Apr 14, 2016
Makefile tests: replace sed with a python script Dec 9, 2016 Add Atomic scan JSON specification. Aug 19, 2016 Add Atomic scan JSON specification. Aug 19, 2016
Vagrantfile Add fedora25_cloud target for vagrant Nov 30, 2016
atomic main: Don't catch all AttributeErrors Jan 3, 2017 Move atomic ps to atomic containers Sep 2, 2016
atomic.conf add keyring override config Sep 26, 2016 fix up typo in var name Jul 16, 2015
atomic.sysconfig atomic.sysconfig: leave default TOOLSIMG undefined Jul 17, 2015 Atomic/ Fix dbus implementation of image verify Jan 3, 2017 run: add --detach and only add -t if in a TTY Dec 5, 2016
atomicdesign.pdf Add design document Jan 29, 2015
dockertar-sha256-helper.go Add helper to compute sha256 for Docker save'd tarballs Apr 18, 2016
gotar.go Source code for gotar binary Aug 18, 2016 Fixes issues in atomic migrate export and import. Disable test_migrat… Aug 18, 2016
org.atomic.conf Add dbus support for version and verify May 18, 2015
org.atomic.policy Change atomic dbus permissions Jul 8, 2016
org.atomic.service Rename to Jul 13, 2015
requirements.txt update default trust policy file Jan 16, 2017 Refactor images Nov 29, 2016 The HELP label by default should be "help" Nov 28, 2016 Add fedora25_cloud target for vagrant Nov 30, 2016

Atomic: /usr/bin/atomic

This project defines the entrypoint for Project Atomic hosts. On an Atomic Host, there are at least two distinct software delivery vehicles; Docker (often used in combination with the traditional RPM/yum/dnf), and rpm-ostree to provide atomic upgrades of the host system.

The goal of Atomic is to provide a high level, coherent entrypoint to the system, and fill in gaps in Linux container implementations.

For Docker, atomic can make it easier to interact with special kinds of containers, such as super-privileged debugging tools and the like.

The atomic host subcommand wraps rpm-ostree, currently just providing a friendlier name, but in the future Atomic may provide more unified management.

atomic run

Atomic allows an image provider to specify how a container image expects to be run.

Specifically this includes the privilege level required.

For example if you built an 'ntpd' container application, that required the SYS_TIME capability, you could add meta data to your container image using the command:

LABEL RUN /usr/bin/docker run -d --cap-add=SYS_TIME ntpd

Now if you executed atomic run ntpd, it would read the LABEL RUN json metadata from the container image and execute this command.

atomic install

Most of the time when you ship an application, you need to run an install script. This script would configure the system to run the application, for example it might configure a systemd unit file or configure kubernetes to run the application. This tool will allow application developers to embed the install and uninstall scripts within the application. The application developers can then define the LABEL INSTALL and LABEL UNINSTALL methods, in the image meta data. Here is a simple httpd installation description.

cat Dockerfile

# Example Dockerfile for httpd application
FROM        fedora
ENV container docker
RUN yum -y update; yum -y install httpd; yum clean all

LABEL Vendor="Red Hat" License=GPLv2
LABEL Version=1.0
LABEL INSTALL="docker run --rm --privileged -v /:/host -e HOST=/host -e LOGDIR=/var/log/\${NAME} -e CONFDIR=/etc/\${NAME} -e DATADIR=/var/lib/\${NAME} -e IMAGE=\${IMAGE} -e NAME=\${NAME} \${IMAGE} /bin/"
LABEL UNINSTALL="docker run --rm --privileged -v /:/host -e HOST=/host -e IMAGE=${IMAGE} -e NAME=${NAME} ${IMAGE} /bin/"
ADD root /


CMD [ "/usr/sbin/httpd", "-D", "FOREGROUND" ]

atomic install will read the LABEL INSTALL line and substitute ${NAME} with the name specified with the name option, or use the image name, it will also replace${IMAGE} with the image name.

To be used by the application. The install script could populate these directories if necessary.

In my example the INSTALL method will execute the which we add to the image. The root sub directory contains the following scripts:

The atomic install will set the following environment variables for use in the command:

SUDO_UID The SUDO_UID environment variable. This is useful with the docker -u option for user space tools. If the environment variable is not available, the value of /proc/self/loginuid is used.

SUDO_GID The SUDO_GID environment variable. This is useful with the docker -u option for user space tools. If the environment variable is not available, the default GID of the value for SUDO_UID is used. If this value is not available, the value of /proc/self/loginuid is used.

cat root/usr/bin/

# Make Data Dirs
mkdir -p ${HOST}/${CONFDIR} ${HOST}/${LOGDIR}/httpd ${HOST}/${DATADIR}

# Copy Config
cp -pR /etc/httpd ${HOST}/${CONFDIR}

# Create Container
chroot ${HOST} /usr/bin/docker create -v /var/log/${NAME}/httpd:/var/log/httpd:Z -v /var/lib/${NAME}:/var/lib/httpd:Z --name ${NAME} ${IMAGE}

# Install systemd unit file for running container
sed -e "s/TEMPLATE/${NAME}/g" etc/systemd/system/httpd_template.service > ${HOST}/etc/systemd/system/httpd_${NAME}.service

# Enabled systemd unit file
chroot ${HOST} /usr/bin/systemctl enable /etc/systemd/system/httpd_${NAME}.service

atomic uninstall

The atomic unistall does the same variable substitution as described for install, and can be used to remove any host system configuration.

Here is the example script we used.

cat root/usr/bin/

chroot ${HOST} /usr/bin/systemctl disable /etc/systemd/system/httpd_${NAME}.service
rm -f ${HOST}/etc/systemd/system/httpd_${NAME}.service

Finally here is the systemd unit file template I used:

cat root/etc/systemd/system/httpd_template.service

# cat ./root/etc/systemd/system/httpd_template.service
Description=The Apache HTTP Server for TEMPLATE

ExecStart=/usr/bin/docker start TEMPLATE
ExecStop=/usr/bin/docker stop TEMPLATE
ExecReload=/usr/bin/docker exec -t TEMPLATE /usr/sbin/httpd $OPTIONS -k graceful


For an explaination of the Atomic scan JSON output, see the JSON specification document.