Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Resiliency for a Missing Docker Image #796

Closed
rmartin16 opened this issue Jul 21, 2022 · 1 comment
Closed

Add Resiliency for a Missing Docker Image #796

rmartin16 opened this issue Jul 21, 2022 · 1 comment
Labels
enhancement New features, or improvements to existing features. linux The issue relates Linux support.

Comments

@rmartin16
Copy link
Member

rmartin16 commented Jul 21, 2022

Is your feature request related to a problem? Please describe.
When using Docker, only the briefcase create command supports creating the image to create containers to run commands. If this docker image is deleted, commands other than create fail to run.

Error example
❯ briefcase build -v

>>> Running Command:
>>>     docker --version
>>> Command Output:
>>>     Docker version 20.10.17, build 100c701
>>> Return code: 0

>>> Running Command:
>>>     docker info
>>> Command Output:
>>>     Client:
>>>      Context:    default
>>>      Debug Mode: false
>>>      Plugins:
>>>       app: Docker App (Docker Inc., v0.9.1-beta3)
>>>       buildx: Docker Buildx (Docker Inc., v0.8.2-docker)
>>>       scan: Docker Scan (Docker Inc., v0.17.0)
>>>     
>>>     Server:
>>>      Containers: 0
>>>       Running: 0
>>>       Paused: 0
>>>       Stopped: 0
>>>      Images: 0
>>>      Server Version: 20.10.17
>>>      Storage Driver: overlay2
>>>       Backing Filesystem: extfs
>>>       Supports d_type: true
>>>       Native Overlay Diff: true
>>>       userxattr: false
>>>      Logging Driver: json-file
>>>      Cgroup Driver: systemd
>>>      Cgroup Version: 2
>>>      Plugins:
>>>       Volume: local
>>>       Network: bridge host ipvlan macvlan null overlay
>>>       Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
>>>      Swarm: inactive
>>>      Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
>>>      Default Runtime: runc
>>>      Init Binary: docker-init
>>>      containerd version: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
>>>      runc version: v1.1.2-0-ga916309
>>>      init version: de40ad0
>>>      Security Options:
>>>       apparmor
>>>       seccomp
>>>        Profile: default
>>>       cgroupns
>>>      Kernel Version: 5.18.10-76051810-generic
>>>      Operating System: Pop!_OS 22.04 LTS
>>>      OSType: linux
>>>      Architecture: x86_64
>>>      CPUs: 16
>>>      Total Memory: 62.71GiB
>>>      Name: jupiter
>>>      ID: LKHY:6UZ7:EO3B:256N:2JAP:OIQY:HN3Q:NIZ2:53DL:3ZVC:2R5I:MUKK
>>>      Docker Root Dir: /var/lib/docker
>>>      Debug Mode: false
>>>      Registry: https://index.docker.io/v1/
>>>      Labels:
>>>      Experimental: false
>>>      Insecure Registries:
>>>       127.0.0.0/8
>>>      Live Restore Enabled: false
>>>     
>>> Return code: 0

[pre] Building AppImage...

[pre] Entering Docker context...

>>> Running Command:
>>>     docker run --volume /home/russell/tmp/beeware/pre/linux:/app:z --volume /home/russell/.cache/briefcase:/home/brutus/.local/share/briefcase:z --rm --env VERSION=0.0.1 
briefcase/com.example.pre:py3.10 /home/brutus/.local/share/briefcase/tools/linuxdeploy-x86_64.AppImage --appimage-extract-and-run --appdir=/app/appimage/pre/pre.AppDir -d 
/app/appimage/pre/pre.AppDir/com.example.pre.desktop -o appimage --deploy-deps-only /app/appimage/pre/pre.AppDir/usr/app_packages/cairo --deploy-deps-only 
/app/appimage/pre/pre.AppDir/usr/app_packages/gi --deploy-deps-only /app/appimage/pre/pre.AppDir/usr/lib --deploy-deps-only /app/appimage/pre/pre.AppDir/usr/lib/python3.10/lib-dynload
Unable to find image 'briefcase/com.example.pre:py3.10' locally
docker: Error response from daemon: pull access denied for briefcase/com.example.pre, repository does not exist or may require 'docker login': denied: requested access to the resource is 
denied.
See 'docker run --help'.
>>> Return code: 125
Building...

Error while building app pre.

Log saved to /home/russell/tmp/beeware/pre/briefcase.2022_07_21-14_23_40.build.log

Describe the solution you'd like
Anytime a command needs to run thru Docker, create the image if it doesn't exist.

As for an implementation, this may be as simple as calling docker.prepare() before issuing any commands via docker run. Although, that'll invoke running thru the entire Dockerfile again....perhaps a docker image call would be sufficient.

Describe alternatives you've considered
Re-run the briefcase create command to create the Docker image.

@rmartin16 rmartin16 added the enhancement New features, or improvements to existing features. label Jul 21, 2022
@freakboy3742
Copy link
Member

+1 - I've hit this one a few times in testing #756, but I was doing enough weird stuff there that it didn't hit my internal threshold of "dammit, I need to fix this, don't I". :-)

I think you're right about the general approach - Docker builds are pretty heavily cached and optimised for the "no change" case, so the overhead of calling Docker "unnecessarily" is fairly low. We don't want to call build before every call to docker.run() - but once per app at the start of a call to briefcase build would definitely be warranted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New features, or improvements to existing features. linux The issue relates Linux support.
Projects
None yet
Development

No branches or pull requests

2 participants