Building a snap offline


I would like to build a snap offline, i.e. without internet access.

For this I would like to download all dependencies (the parts) beforehand, while I do have internet access, and then run snapcraft at a later point, when the machine is offline.

Is this a supported use-case? If yes, how?

I already tried the following (example: lxd)

# Pull all (?) dependencies while having internet access.
snapcraft pull lxd --destructive-mode

# Switch of internet access

# Now launch the build.
snapcraft --destructive-mode

Unfortunately, the above approach does not work, since snapcraft seems to be trying to contact the snap store when starting the build.

Is there another way?


1 Like

It is not currently supported, unfortunately. It might not be a significant amount of work to change it, but there are a handful of places where snapcraft is going to assume network connectivity.