Docker in Docker
Buddy offers a complete collection of tools and services required to build, test and deploy Docker images. Users who demand more flexibility in their process can use the Docker CLI action. The action runs commands on an Ubuntu VM with preinstalled Docker CLI in the context of the Git repository to which the pipeline is attached.
This is especially useful for operations that require:
docker-compose
- privileged access to Docker containers (Docker-in-Docker)
- access to the Docker daemon
Image loading...
Caching
- When the action is run, Buddy copies the files from the pipeline filesystem with the clone of the repository to the VM with Docker.
- Once finished, the output is transferred back to the filesystem (by default
/home/ubuntu/build
) and the VM is killed. - If you are building or pulling images from the VM, you can attach a drive to cache images, layers, and containers and speed up your delivery process.
- To enable caching, go to Options and check Attach cache drive to VM running this action. This will mount a drive to the
/var/lib/docker
path.
Sharing cache with other actions
By default, each Docker CLI action uses its own cache attached to the host VM. If you are running multiple CLI actions, you can force them to share the same cache by checking the 'Use shared cache drive' option.
Parallelism
If you run two actions sharing the same cache in parallel, the second action will create another drive and use it independently until the interval between pipeline runs is more than 7 days (disk retention period).
Clearing cache
If you purge the pipeline cache, all drives attached to Docker CLI actions will be removed – even if they are shared with actions in other pipelines.
Containers in shared cache
If you run a container in the action (e.g. docker run --name mongo-db -d mongo
) and do not kill it manually in the end, the container image will remain in the cache. This means that if you run the container in another Docker CLI action sharing the same cache, it will fail with an error like this:
docker: Error response from daemon: Conflict. The container name "/mongo-db" is already in use`.
To solve this, launch the container with docker start
instead of docker run
. For example:
bashdocker start mongo-db
$$
Last modified on Sep 26, 2024