Advanced Practice: Embedded Images and Upstream Customization
Goal
After this guide, you can verify these 3 points:
- Understand persistence boundary:
/lzcapp/varpersists after restart; manual changes in runtime paths (such as/home/lazycat) are lost unless baked into image/startup logic. /lzcapp/documentsis for user documents access and is not the same as app-private persistence.- Master basic LPK v2 embedded image flow: customize upstream image with small changes and publish.
Prerequisites
- You completed How LPK Works.
- Target system supports LPK v2 embedded image (recommend lzcos 1.5.0+).
lzc-cli project deployworks in your environment.
Steps
1. Create project from gui-vnc template
lzc-cli project create embed-demo -t gui-vncAt app id prompt, press Enter for default id or type your own.
cd embed-demo2. Check template key configuration
Check lzc-build.yml:
cat lzc-build.ymlYou should see:
images.app-runtimebuilt fromimages/Dockerfile.upstream-match: registry.lazycat.cloudconfigured.lzc-manifest.ymlreferences image asembed:app-runtime.
3. First deploy and access verification
lzc-cli project deploy
lzc-cli project info
# Wait until the app reaches running state, then continue.By default, project commands prefer lzc-build.dev.yml when it exists. Each command prints the active Build config. Use --release if you want to operate on lzc-build.yml.
Record Target URL from project info and open it in browser.
4. Manually link documents path to desktop (verification first)
Enter container:
lzc-cli project exec -s desktop /bin/shThen run inside shell:
mkdir -p /home/lazycat/Desktop
ln -svfn /lzcapp/documents "/home/lazycat/Desktop/Documents (ReadWrite)"
ls -la /home/lazycat/Desktop
ls -la /lzcapp/documents
exitRefresh VNC desktop, you should see Documents (ReadWrite) and be able to access /lzcapp/documents data.
5. Restart app and observe link loss
lzc-cli project start --restartCheck again in container or desktop. The manual link under /home/lazycat/Desktop will be lost after restart.
This is expected: data outside /lzcapp/var is not guaranteed to persist across restart.
Further reading:
6. Persist link logic with Dockerfile/startup script
For reproducible behavior, bake link creation into image startup logic.
gui-vnc template includes images/startup-script.sh. Ensure it includes:
mkdir -p /home/lazycat/Desktop
ln -svfn /lzcapp/documents "/home/lazycat/Desktop/Documents (ReadWrite)"In images/Dockerfile, ensure startup script is copied. The startup-script.desktop line is commented by default; uncomment it before deploy:
COPY --chown=lazycat:kasm-user startup-script.sh /home/lazycat/.config/autostart/startup-script.sh
# COPY --chown=lazycat:kasm-user startup-script.desktop /home/lazycat/.config/autostart/startup-script.desktop
RUN chmod +x /home/lazycat/.config/autostart/startup-script.shRemove # for the startup-script.desktop COPY line and save.
Then redeploy (project deploy will start app automatically):
lzc-cli project deploy
lzc-cli project infoWait until app is running, then verify Documents (ReadWrite) appears automatically.
LPK is designed for one-click reproducible delivery to others. To keep runtime deterministic, only explicitly declared persistent directories are retained; other path changes are cleaned after restart.
Further reading:
7. Verify package contains embedded image
lzc-cli project release -o embed-demo.lpk
lzc-cli lpk info embed-demo.lpkExpected:
image_countis greater than0.images:includes aliasapp-runtimeand layer source summary (embedded_layers/upstream_layers).
Verification
Pass conditions:
project infoshowsCurrent version deployed: yes.Target URLopens desktop page.Documents (ReadWrite)still appears after restart (created by startup script).lzc-cli lpk info embed-demo.lpkshows embedded image summary.
Troubleshooting
1. Cannot resolve embedded image alias
Reason: embed:<alias> does not match images.<alias>.
Fix: align alias between lzc-manifest.yml and lzc-build.yml, then redeploy.
2. Build is too slow
Checks:
- First build can be slow (upstream layers download).
- Small Dockerfile changes on second build should be much faster.
- Use
lzc-cli project log -fto check repeated layer fetching.
3. Page is blank or unreachable
Check order:
application.routespoints tohttp://desktop:6901/.- Run
lzc-cli project log -s desktop -f. - Run
lzc-cli project exec -s desktop /bin/shand inspect process status.
4. Documents link/desktop entry missing
- Ensure
images/startup-script.shcontains link commands. - Ensure
COPY startup-script.desktop ...is uncommented inimages/Dockerfile. - Ensure
images/startup-script.desktopexists andExecpoints tostartup-script.sh. - Redeploy and confirm running with
lzc-cli project info.