Skip to content

Add Resiliency for a Missing Docker Image #796

@rmartin16

Description

@rmartin16

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew features, or improvements to existing features.linuxThe issue relates Linux support.
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions