projects/compose/README.md
The purpose of this project is to show how moby and linuxkit can be used to build a runnable linuxkit image with compose-style apps ready-to-run.
The apps are simple:
We provide samples of two methods for using compose: dynamic and static.
Both methods use the image linuxkit/compose. The image does the following:
/images/*.tar, treat them as tarred up docker images and load them into docker via docker load ...docker compose ...The only difference between dynamic and static is whether or not container images are pre-loaded in the linuxkit image.
linuxkit/compose image looks for a compose file at /compose/docker-compose.ymllinuxkit/compose image looks for tarred container images at /compose/images/*.tarDynamic loads the compose config into the linuxkit image at build time. Container images are not pre-loaded, and thus docker loads the container images from the registry at run-time. This is no different than doing the following:
Except that the compose is run at launch time, and there is no need for a remote connection to the docker API.
It works by loading the docker-compose.yml file onto the linuxkit image, and making it available to the compose container image via a bind-mount.
To build a dynamic image, do make dynamic. To run it, do make run-dynamic.
Static loads the compose config and the container images into the linuxkit image at build time. When run, docker loads the images from its local cache and does not depend on access to a registry.
It works by loading the docker-compose.yml file onto the linuxkit image and tarred up container image files. It then makes them available to the compose container image via bind-mounts.
To build a static image, do make static. To run it, do make run-static.
Static images pre-load them by doing:
docker image pull <image>docker image save -o <image> <imagename>.tardocker image load -i <image> && rm -f <imagename>.tarA final option would be converting all of the containers defined in a docker-compose.yml into linuxkit services. It also would require setting up appropriate networks and other services provided by docker when running compose.
An example may be added in the future.