├── DOCKER_AND_COMPOSE_VERSION_MATRIX ├── Dockerfile ├── LICENSE ├── README.md ├── docker-compose.test.yml └── hooks ├── build ├── push └── test /DOCKER_AND_COMPOSE_VERSION_MATRIX: -------------------------------------------------------------------------------- 1 | latest 2 | 20.10 1.29.* 3 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | ARG DOCKER_VERSION=latest 2 | FROM docker:${DOCKER_VERSION} 3 | 4 | ARG COMPOSE_VERSION= 5 | ARG DOCKER_VERSION 6 | 7 | ENV PATH /usr/bin:$PATH 8 | 9 | RUN apk add --no-cache py3-pip python3 10 | RUN apk add --no-cache --virtual \ 11 | build-dependencies \ 12 | cargo \ 13 | gcc \ 14 | libc-dev \ 15 | libffi-dev \ 16 | make \ 17 | openssl-dev \ 18 | python3-dev \ 19 | rust \ 20 | && pip3 install "docker-compose${COMPOSE_VERSION:+==}${COMPOSE_VERSION}" \ 21 | && apk del build-dependencies 22 | 23 | LABEL \ 24 | org.opencontainers.image.authors="Tobias Maier " \ 25 | org.opencontainers.image.description="This docker image installs docker-compose on top of the docker image." \ 26 | org.opencontainers.image.licenses="MIT" \ 27 | org.opencontainers.image.source="https://github.com/tmaier/docker-compose" \ 28 | org.opencontainers.image.title="Docker Compose on docker base image" \ 29 | org.opencontainers.image.vendor="BauCloud GmbH" \ 30 | org.opencontainers.image.version="${DOCKER_VERSION} with docker-compose ${COMPOSE_VERSION}" 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Tobias L. Maier 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Docker Compose 2 | 3 | [![Docker Automated build](https://img.shields.io/docker/automated/tmaier/docker-compose.svg)](https://hub.docker.com/r/tmaier/docker-compose/) 4 | [![Docker Pulls](https://img.shields.io/docker/pulls/tmaier/docker-compose.svg)](https://hub.docker.com/r/tmaier/docker-compose/) 5 | [![GitHub issues](https://img.shields.io/github/issues/tmaier/docker-compose.svg)](https://github.com/tmaier/docker-compose/issues) 6 | [![GitHub stars](https://img.shields.io/github/stars/tmaier/docker-compose.svg?style=social&label=Star)](https://github.com/tmaier/docker-compose) 7 | 8 | This docker image installs docker-compose on top of the `docker` image. 9 | This is very useful for CI pipelines, which leverage "Docker in Docker". 10 | 11 | ## This Docker image is DEPRECATED 12 | 13 | This image is deprecated, since the [`docker` image](https://hub.docker.com/_/docker) has now Docker Compose included. 14 | This has been introduced by [docker-library/docker#361](https://github.com/docker-library/docker/pull/361). 15 | 16 | ## Docker versions supported 17 | 18 | The Docker Compose versions supported here use the most recent docker version compatible with it. 19 | 20 | All available Docker Engine versions and the respective Docker Compose versions are defined in [`DOCKER_AND_COMPOSE_VERSION_MATRIX`](./DOCKER_AND_COMPOSE_VERSION_MATRIX). 21 | 22 | Please open an issue or a pull request (preferred) [at GitHub](https://github.com/tmaier/docker-compose), if a version is missing. 23 | 24 | **Note:** In the past. this docker image (tags) focused on the docker version (e.g. `latest`, `20.10`, `19.03` and `19`). 25 | But as the docker releases got less disruptive, the approach changes to use the docker compose version as tags. 26 | 27 | ## Usage instructions for GitLab CI 28 | 29 | You may use it like this in your `.gitlab-ci.yml` file. 30 | 31 | ```yaml 32 | image: tmaier/docker-compose:latest 33 | 34 | services: 35 | - docker:dind 36 | 37 | before_script: 38 | - docker info 39 | - docker-compose --version 40 | 41 | build image: 42 | stage: build 43 | script: 44 | - docker-compose build 45 | ``` 46 | 47 | ## How to add support for a new docker version to this repository? 48 | 49 | You must only provide a Pull Request for the file [`DOCKER_AND_COMPOSE_VERSION_MATRIX`](./DOCKER_AND_COMPOSE_VERSION_MATRIX). 50 | 51 | `DOCKER_AND_COMPOSE_VERSION_MATRIX` specifies in the first column the docker version. 52 | The second column states the most recent release of docker-compose when the docker version has been released. 53 | 54 | You can see the latest matching versions of both by checking their release notes: 55 | 56 | - https://github.com/docker/docker-ce/releases or https://hub.docker.com/_/docker 57 | - https://github.com/docker/compose/releases 58 | 59 | ## Common issues and possible fixes 60 | 61 | ### `ERROR: error during connect: Get http://docker:2375/v1.40/info: dial tcp: ...` 62 | 63 | > As of version 19.03, docker:dind will automatically generate TLS certificates and require using them for communication. 64 | 65 | See 66 | 67 | ## Author 68 | 69 | [Tobias L. Maier](http://tobiasmaier.info) for [BauCloud GmbH](https://www.baucloud.com) 70 | -------------------------------------------------------------------------------- /docker-compose.test.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | sut: 4 | image: ${IMAGE_NAME} 5 | command: docker-compose version 6 | -------------------------------------------------------------------------------- /hooks/build: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | set -e 4 | 5 | while read -r docker_version compose_version; 6 | do 7 | if [ -z "${compose_version}" ] 8 | then 9 | tag="latest" 10 | else 11 | tag="${compose_version%.*}" 12 | fi 13 | image=${DOCKER_REPO}:${tag} 14 | 15 | echo "# Building image ${image}..." 16 | 17 | docker build \ 18 | --build-arg DOCKER_VERSION="${docker_version}" \ 19 | --build-arg COMPOSE_VERSION="${compose_version}" \ 20 | --pull \ 21 | -t "${image}" . 22 | done < DOCKER_AND_COMPOSE_VERSION_MATRIX 23 | -------------------------------------------------------------------------------- /hooks/push: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | set -e 4 | 5 | while read -r _ compose_version; 6 | do 7 | if [ -z "${compose_version}" ] 8 | then 9 | tag="latest" 10 | else 11 | tag="${compose_version%.*}" 12 | fi 13 | image=${DOCKER_REPO}:${tag} 14 | 15 | echo "# Pushing image ${image}..." 16 | 17 | docker image push "${image}" 18 | done < DOCKER_AND_COMPOSE_VERSION_MATRIX 19 | -------------------------------------------------------------------------------- /hooks/test: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | set -e 4 | 5 | while read -r docker_version compose_version; 6 | do 7 | if [ -z "${compose_version}" ] 8 | then 9 | tag="latest" 10 | else 11 | tag="${compose_version%.*}" 12 | fi 13 | image=${DOCKER_REPO}:${tag} 14 | 15 | echo "# Testing image ${image}..." 16 | export IMAGE_NAME="${image}" 17 | 18 | container=$(docker-compose -f docker-compose.test.yml run -d sut) 19 | 20 | if [ "$(docker container wait "${container}")" != "0" ] 21 | then 22 | echo "Test of ${IMAGE_NAME} failed" 23 | exit 1 24 | fi 25 | docker-compose -f docker-compose.test.yml rm --force sut 26 | done < DOCKER_AND_COMPOSE_VERSION_MATRIX 27 | --------------------------------------------------------------------------------