do not reload the list of all the images every time we check if an image
is dangling. This makes "images list" extremely slow when used on the
Docker backend.
On my system (with ~100 images), this patch brings down the wall clock
from ~10 seconds to ~0.5 seconds:
$ /usr/bin/time -v ./atomic images list -a 2>&1 | grep "wall clock"
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:09.84
to:
$ /usr/bin/time -v ./atomic images list -a 2>&1 | grep "wall clock"
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.58
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Closes: #1200
Approved by: rhatdan
Fix test failures after updating papr to test with f26 atomic/cloud
images instead of f25, with the following changes:
1. Remove dependency on docker hub tester image. Instead, mimic
what ostree/rpm-ostree does and use a recursive .papr.sh script
to install the necessary packages to the base f26 image in the
fedora registry. This fixes tests on the atomic host since python3.6
is being used, and prevents future tests from testing the wrong
version. (Note this is slightly slower due to having to install
packages during the test rather than using a pre-built image).
2. Fix some pylint errors, and mask others for now
3. Fix failing integration tests due to inter-test interference
4. Remove unnecessary deepcopy in container filter
5. Add compatibility for both c-s-s and d-s-s in storage
6. Update expected sha256 values for dockertar test
Remaining issues:
1. test_storage should possibly be reworked. The current test
setup is conflicting with the new default of overlay as a driver.
For now, the test for generated d-s-s is disabled.
2. some storage commands are still using "docker-storage-setup"
instead of "container-storage-setup". There is a backward
compatible check in place that should be reworked in the future
3. some masked pylint errors should be further investigated
4. keep the dockerfile for the project atomic tester image for now
(bump to 26), since its a little easier and faster to set up with
Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>
Closes: #1076
Approved by: baude
Rework images list and image filtering to display images tagged
with `atomic images tag`. The output now matches `docker images`.
Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>
Closes: #1017
Approved by: baude
'atomic images info' on a system container image was not displaying
the environment variables in the container anymore. This was due to
get_backend_and_image_obj() function decomposing the img_obj.image
to not be the full image name. img_obj.name should be used instead.
Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>
Closes: #947
Approved by: giuseppe
When running an image with atomic run, if the container already exists,
we were accidently displaying a message stating that the container's
image was old. This was due to an invalid comparison between the container's
image id and the image's id. The comparison was failing because we were
comparing two different variables and not the ids.
This was reported in bugzilla https://bugzilla.redhat.com/show_bug.cgi?id=1434430
Closes: #945
Approved by: rhatdan
If the image is built (and updated) locally, we need to handle this
differently than if the image came from a registry. We now
can try/except our way through things and properly handle.
Closes: #938
Approved by: rhatdan
An exception was being thrown when trying to run a command inside
an already running container. For example:
sudo atomic run foobar echo true
The problem was a lack of a setter for user_command in the container
object as well as some mishandled string <-> list conversions.
Closes: #938
Approved by: rhatdan
Change the format of "Created" for images to match containers,
fix filtering for partial keywords, and update auto-complete
and man pages.
Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>
Closes: #923
Approved by: giuseppe
When calling atomic images info --storage ostree <some_image>, the
FQ Name of the image being returned was incorrect. We now call
Decompose to set the name correctly in the image object.
This was reported as a side issue in https://github.com/projectatomic/atomic/issues/870
Closes: #897
Approved by: rhatdan
There were bugs in the run behavior in several scenarios:
* running an image with a command
* running a container that is stopped with and without a command
* running a container that is running with and without a command
Closes: #880
Approved by: rhatdan
If an image from a registry has a label like:
atomic.type=system
the Atomic CLI will now detect that prior to pulling
the image. It will then switch the backend storage
to ostree. In the case of install, it will both
pull to ostree and install it.
If the backend is switched, a message informing the user
as such will be shown.
The detection and switch of the backend can be overriden
with the --storage option.
The following is an example of install:
$ sudo atomic install atomic-registry.usersys.redhat.com:5000/brentbaude/helloworld:latest
Note: Switching from the 'docker' backend to the 'ostree' backend based on the 'atomic.type' label in the image. You can use --storage to override this behaviour.
Extracting to /var/lib/containers/atomic/helloworld.0
systemctl daemon-reload
systemctl enable helloworld
$ sudo ./atomic images list
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE TYPE
atomic-registry.usersys.redhat.com:5000/brentbaude/helloworld latest 0056366e4ebd 2017-02-01 18:04 ostree
$ sudo ./atomic containers list -a
CONTAINER ID IMAGE COMMAND CREATED STATE BACKEND RUNTIME
helloworld atomic-registry.user /usr/bin/run.sh 2017-02-01 18:04 failed ostree runc
Closes: #861
Approved by: baude
Users wish to be able to pull images by digest. This can be
done by docker and therefore parity is preferred. The request
is described in https://github.com/projectatomic/atomic/issues/691.
$ atomic pull busybox@sha256:29f5d56d12684887bdfa50dcd29fc31eea4aaf4ad3bec43daf19026a7ce69912
Pulling docker.io/busybox@sha256:29f5d56d12684887bdfa50dcd29fc31eea4aaf4ad3bec43daf19026a7ce69912 ...
Copying blob sha256:56bec22e355981d8ba0878c6c2f23b21f422f30ab0aba188b54f1ffeff59c190
495.23 KB / 652.49 KB [=========================================>-------------]
Copying config sha256:e02e811dd08fd49e7f6032625495118e63f597eb150403d02e3238af1df240ba
0 B / 1.43 KB [---------------------------------------------------------------]
Writing manifest to image destination
Storing signatures
1.43 KB / 1.43 KB [===========================================================]
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/busybox 29f5d56d12684887bdfa50dcd29fc31eea4aaf4ad3bec43daf19026a7ce69912 e02e811dd08f 3 months ago 1.093 MB
Note how the tag is populated with the digest. Docker's default behaviour is
to populate the tag with nothing. We cannot currently replicate that exactly.
Closes: #856
Approved by: baude
Ideally, the atomic CLI should be able to operate independently
of the backends it supports. For example, if dockerd is inactive,
the ostree backend and atomic cli should still work.
This requires some tweaking to the backendutils code and the work
flow. We also need to specifically know if the user passes
--storage so that we treat that as an explicit override. The work
flow is now roughly:
* a default storage can be defined in atomic.conf (was always this way)
* if not defined, defaults to docker.
* if --storage is passed, treat explictly and fail if cannot execute
* if no --storage is specified, use default. if default is not available, move
onto the next backend.
In the case where the image is on a V1 registry, the id
will not be available. If the id is None, we cannot
run the def no_shaw on it because you cannot run str.replace
on something that is None.
Closes: #843
Approved by: rhatdan
The RUN label was not being used correctly by Atomic CLI and therefore
resulted in incorrect runargs being used. We should be leaning on using
the cmd and entry points as defined and not mess with those in the
building of the command itself.
This was reported in
issue https://github.com/projectatomic/atomic/issues/838.
Closes: #842
Approved by: rhatdan
Refactor several of the atomic verbs and subverbs to take advantage
of object refactoring.
Also, do not pull images with skopeo if the local image is already
at the latest.
$ sudo python ./atomic --debug pull busybox
Namespace(_class=<class 'Atomic.pull.Pull'>, assumeyes=False, debug=True, func='pull_image', image='busybox', reg_type=None, storage='docker')
Latest version of busybox already present.
Closes: #825
Approved by: baude
Restructured conditional for obtaining the remote image id
for v1. This fixes a traceback related to verifying v1
images on the rhel registry.
Closes: #814
Approved by: rhatdan
This is the ID used by Docker in "docker images", use the same ID it
so that images stored into OSTree, either from a Docker registry or
from the local Docker engine, have the same ID.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Closes: #779
Approved by: rhatdan
With the exception of fstrim, the containers verb has now been
refactored. It primarily now uses the containers object in its
implementation.
Closes: #792
Approved by: rhatdan
Using our refactoring model, verify is now streamlined. We no longer
compare base images as that is not currently possible for both
V1 and V2 schemas.
Verify will now always look at the release and version labels for
comparison. Should those labels not exist, it will use the
manifest digest for ostree; and it will use the image IDs for
docker.
Closes: #785
Approved by: rhatdan
Covers all but verify and generate. This is a refactoring of the
images subverbs (i.e. info, version, delete, ...)
Added in a unittest for list and info.
Closes: #771
Approved by: baude
If the has_image|has_container evals to True, then return
the proper object; else None
Add unittest structure for backends/backendutils.py
We want to make sure we have a good backend/backendutils
unittest. This should simplify unittests for all backends.
refactor.py: Remove the file used to help mini-test the
refactoring work. It is not needed by upstream and was
only including during the development phases.
Closes: #757
Approved by: baude
Atomic/backendutils.py: Class for working with unknown backend
Atomic/objects/image|layer|container.py: classes for objects
Atomic/backends/backend|_docker|_ostree.py: Abstract backends for ostree and docker
Closes: #757
Approved by: baude