eth-cscs / sarus

OCI-compatible engine to deploy Linux containers on HPC environments.
https://sarus.readthedocs.io/en/stable/
BSD 3-Clause "New" or "Revised" License
130 stars 10 forks source link

`sarus run` failing without a tag when latest is not available #35

Closed aurianer closed 10 months ago

aurianer commented 10 months ago

This is not urgent at all but would be nice to have :)

In case I have one ubuntu image e.g. tag jammy available, I would like to be able to do sarus run -t ubuntu without specifying the tag. This command errors out:

$  sarus --version
1.6.2
$  sarus images
REPOSITORY   TAG          IMAGE ID       CREATED               SIZE         SERVER
ubuntu       jammy        174c8c134b2a   2024-01-11T15:36:32   28.40MB      docker.io
$  sarus run -t ubuntu
Image docker.io/library/ubuntu:latest is not available. Attempting to look for equivalent image in index.docker.io server repositories
Image index.docker.io/library/ubuntu:latest is not available
$  sarus run -t ubuntu:jammy
emily@desktop:/$ 

podman equivalent:

$  podman images
REPOSITORY                      TAG         IMAGE ID      CREATED        SIZE
docker.io/library/ubuntu        jammy       174c8c134b2a  4 weeks ago    80.4 MB
$  podman run -t ubuntu
root@78280fae6072:/# 
Madeeks commented 10 months ago

Hi @aurianer, thanks for opening this issue. I'm in doubt about this feature request. The behavior of Docker and Podman with the versions I'm currently using on my laptop is to default a non-specified tag to latest (which I believe has been an established behavior for quite a while):

$  docker --version
Docker version 23.0.6-ce, build 9dbdbd4b6d76
$  docker images ubuntu
REPOSITORY   TAG       IMAGE ID       CREATED         SIZE
ubuntu       20.04     1c5c8d0b973a   10 months ago   72.8MB
ubuntu       22.04     d2e4e1f51132   20 months ago   77.8MB
$  docker run --rm -it ubuntu
Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
a48641193673: Pull complete 
Digest: sha256:6042500cf4b44023ea1894effe7890666b0c5c7871ed83a97c36c76ae560bb9b
Status: Downloaded newer image for ubuntu:latest
root@836bce26f5b3:/# 

------------
$  podman --version
podman version 4.4.4
$ podman images ubuntu
REPOSITORY                TAG         IMAGE ID      CREATED      SIZE
docker.io/library/ubuntu  22.04       b6548eacb063  6 weeks ago  80.4 MB
$ podman run --rm -it docker.io/library/ubuntu
Trying to pull docker.io/library/ubuntu:latest...
Getting image source signatures
Copying blob a48641193673 done  
Copying config 174c8c134b done  
Writing manifest to image destination
Storing signatures
root@6dc7b9e77988:/# 

Which version of Podman did you use for your example?

Additionally, I'm slightly concerned that picking up an available image (even if it's the only one available) without tag might cause confusion, because the outcome of a given command line would be dependent on the state of the machine where it is run: the container being executed would depend on which image is present on the system at a given time. In other words, the same command could use different images on different systems, or on the same system but at different times. It's true that such mismatch between command lines and actual images could happen already when dealing with tags (which are mutable), but the new behavior would introduce another degree of freedom in the matter.

aurianer commented 10 months ago

Yes makes sense, closing this :) For reference podman version 3.4.4