cli icon indicating copy to clipboard operation
cli copied to clipboard

cmd/docker: add docker "app" command and install/launch/remove subcom…

Open qiangli opened this issue 1 year ago • 1 comments

- What I did

This change adds support for managing native applications on the host machine.

- How I did it

To maximize reuse of existing code, minor refactoring has been done. more details in the feature ticket here: https://github.com/docker/cli/issues/5239

- How to verify it

make -f docker.Makefile clean fmt lint shellcheck build make -f docker.Makefile test-unit test-e2e

All unit/e2e tests passed including newly added ones.

New e2e/app tests verify install/launch/remove commands

- Description for the changelog


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


+ build/container/cp options are exported, i.e. renamed and a few setters introduced for changing the values:

	image.BuildOptions
	container.RunOptions
	container.ContainerOptions
	container.CopyOptions

+ runBuild, runRun, runCopy are also renamed to RunBuild, RunRun, and RunCopy accordingly
+ All build flags and a small subset of relevant run flags and cp flags are supported.
+ The following new flags are added:

egress: Set container path to export
destination: Set local host path for app
launch: Start app after installation

in addition, the following existing flags are intercepted and handled by the app command:

iidfile
cidfile
detach

+ New environment variables are introduced for the benefit of app developers:

HOSTOS, HOSTARCH which are assigned the values of runtime.GOOS and runtime.GOARCH from go.


- A picture of a cute animal (not mandatory but encouraged)

qiangli avatar Jul 06 '24 20:07 qiangli

For "app" examples, please see here: https://github.com/dahenito

Check out this PR and build for your host arch, e.g.:

docker buildx bake

build and install this PR as "app" into the default $DOCKER_APP_BASE (~/.docker/app/):

build/docker app install --privileged -v /var/run/docker.sock:/var/run/docker.sock https://github.com/dahenito/docker.git

If successful, the new docker cli with app support should be available under $DOCKER_APP_BASE (~/.docker/app/bin/)

Add the new docker cli to your PATH:

export PATH=$DOCKER_APP_BASE/bin:$PATH

Now you should be able to start building and installing other "apps", e.g go (1.22.5)

docker app install https://github.com/dahenito/[email protected]

qiangli avatar Jul 09 '24 06:07 qiangli