Page MenuHomeVyOS Platform

Create container without downloaded image wrong behavior
Closed, InvalidPublicBUG

Description

When we create a new container but do not have yet image, commit shows a warning, but applied

set container name alp01 image 'alpine'
set container name alp01 network net01
set container network net01 prefix '10.0.0.0/24'

Commit

vyos@r14# compare 
+container {
+    name alp01 {
+        image alpine
+        network net01 {
+        }
+    }
+    network net01 {
+        prefix 10.0.0.0/24
+    }
+}
[edit]
vyos@r14#
vyos@r14# commit

WARNING: Image "alpine" used in contianer "alp01" does not exist locally. Please
use "add container image alpine" to add it to the system! Container
"alp01" will not be started!
[edit]
vyos@r14# 
[edit]
vyos@r14# 
[edit]
vyos@r14# compare 
No changes between working and active configurations.
[edit]
vyos@r14#

It causes an issue after we download an image, the container doesn't start anyway as previous commit applied and did nothing

vyos@r14# run add container image alpine
Resolved "alpine" as an alias (/etc/containers/registries.conf.d/shortnames.conf)
Trying to pull docker.io/library/alpine:latest...
Getting image source signatures
Copying blob 2408cc74d12b done  
Copying config e66264b987 done  
Writing manifest to image destination
Storing signatures
e66264b98777e12192600bf9b4d663655c98a090072e1bab49e233d7531d1294
[edit]
vyos@r14# 
[edit]
vyos@r14# 
[edit]
vyos@r14# 
[edit]
vyos@r14# sudo podman ps -a
CONTAINER ID  IMAGE   COMMAND  CREATED  STATUS  PORTS   NAMES
[edit]
vyos@r14#

To get the container working it required to delete the container configuration and applied it again.

Details

Difficulty level
Unknown (require assessment)
Version
VyOS 1.4-rolling-202206260217
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Unspecified (please specify)

Event Timeline

Viacheslav changed the subtype of this task from "Feature Request" to "Bug".
Viacheslav changed Version from - to VyOS 1.4-rolling-202206260217.Jun 26 2022, 8:37 AM

Why does the image has to be added manually and can not be pulled from the registry if not locally available?

A simple work around could be to trigger a podman start command when a restart container $CONTAINER_NAME is entered. If the pod isnt already running or in a stopped state, it will look at the config and start it up.

Just throwing out ideas.

I don't think the commit comment adequately justifies why we can't pull the image from the internet when starting the container if it does not exist within the on-disk store shared between VyOS images.

This is expected behavior.

Tested on a recent 1.5 image

[email protected]# set container name alp01 image 'alpine'
[email protected]# set container name alp01 network net01
[email protected]# set container network net01 prefix '10.0.0.0/24'
[email protected]# commit
[ container ]

WARNING: Image "alpine" used in container "alp01" does not exist
locally. Please use "add container image alpine" to add it to the
system! Container "alp01" will not be started!


[email protected]:~$ add container image alpine
[email protected]:~$ restart container alp01
Container "alp01" restarted!

[email protected]:~$ show container
CONTAINER ID  IMAGE                            COMMAND     CREATED        STATUS        PORTS       NAMES
449b9af42ac7  docker.io/library/alpine:latest  /bin/sh     3 seconds ago  Up 4 seconds              alp01


[email protected]:~$ connect container alp01
/ # ps
PID   USER     TIME  COMMAND
    1 root      0:00 /bin/sh
    2 root      0:00 /bin/sh
    3 root      0:00 ps
/ #

It's hard to "automatically" restart the container as we do not know which one should be restarted.

I expected the load the image in the background (during the commit), without op-mode.
That's why it was initially opened.
But we must use the load images from op-mode first because otherwise, we have some bugs.