How to install core22 in dockerfile?

I’m trying to load core22 in a Dockerfile, but it seems failed in my circle CI build.

`Failed with exit code: 1
Error: Initializing parts lifecycle
Installing build-packages
The following snaps are required but not installed, as the application is running inside a Docker or Podman container: core22.
Please ensure the environment is properly set up before continuing.
Ignore this message if the appropriate measures have already been taken.
Pulling depends
Fetching stage-packages
Failed to refresh package list: failed to run apt update.`

I think it’s claiming that it can’t find core 22 in my Dockerfile, but I’m using FROM ubuntu:jammy , and I’m also getting core 22 by using the URL below:

curl -L $(curl -H 'X-Ubuntu-Series: 16' '' | jq '.download_url' -r) --output core22.snap && \ mkdir -p /snap/core22 && unsquashfs -d /snap/core22/current core22.snap && rm core22.snap &&

(I came up with this link because the lastest similar link was for core 20)

In my Snapcraft file, I’m also using base:core22 as well.

To provide more information, here’s my snap info in the container:

snap version 
snap    2.61.3+22.04 
snapd   unavailable 
series  - 
snapcraft --version 
snapcraft 8.2.3`

I doubt if is even valid, since I don’t know how to test this.

Sorry I just currently have no idea where to troubleshoot this issue, any idea would be appreciated! Thank you!

That message about the core22 snap doesn’t necessarily mean that the issue is with the snap itself, just that it hasn’t been installed. Can you try to run with higher verbosity so we can see the cause of that Failed to refresh package list: failed to run apt update failure?

You might also want to take a look at the Snapcraft images that we maintain, as they might already serve your use-case or can at least serve as a base for you image.