docker / cli

The Docker CLI
Apache License 2.0
4.75k stars 1.88k forks source link

cmd/docker: add docker "app" command and install/launch/remove subcommands #5239

Open qiangli opened 1 week ago

qiangli commented 1 week ago

Description

Applications are defined as binaries that can execute on the host architecture (docker itself included)

The following new CLI sub commands are supported:

The install sub command combines the existing docker features of building image, running container, and copying the artifacts from the container down to the host machine in one go. The final released files are assumed to be packaged under /egress after the docker image is built or the container is run. The --egress flag can be used to change the default location.

The installation process varies slightly depending on the number of downloaded files and the users' options.

All the files are installed under ~/.docker/app by default, which can be changed with environment variable DOCKER_APP_BASE and the --destination flag on the command line. Each app has its own app path - a subdirectory under the app base that is derived from the URL resource in the form of <appBase>/pkg/scheme/host/path.

  1. Single file If the app is a single binary, it is copied under its app directory and a symlink is created in the /bin

  2. Multiple files with a special file named "run" All files are copied to the app's directory and a symlink is created to the run file in /bin

3) Multiple files with a special file named "install" All files are copied to the app's directory or a location set by the --destination flag and the install is run as a post install step.

If --launch flag is set to true for the above cases 1 and 2, the app will be started after the installation.

The launch sub command performs similar steps of building image and running container, but copies the packaged files from container to a temporary location on the host. This command only applies to a single binary app or one with a special run file.

The remove sub command removes all the files of an app under its package path and its symlink in the bin directory.

qiangli commented 1 week ago

PR: https://github.com/docker/cli/pull/5240