diff --git a/jekyll/_cci2/building-docker-images.adoc b/jekyll/_cci2/building-docker-images.adoc index 3bf50bbaf56..5d5974cff68 100644 --- a/jekyll/_cci2/building-docker-images.adoc +++ b/jekyll/_cci2/building-docker-images.adoc @@ -21,7 +21,7 @@ NOTE: The _remote_ in "remote Docker" is a legacy term from when remote Docker u [#introduction] == Introduction -To build Docker images (for example, using `docker` or `docker-compose` commands) when using the Docker execution environment, you must use the `setup_remote_docker` key in your job: +To build Docker images (for example, using `docker` or `docker compose` commands) when using the Docker execution environment, you must use the `setup_remote_docker` key in your job: {% include snippets/docker-auth.adoc %} diff --git a/jekyll/_cci2/concepts.adoc b/jekyll/_cci2/concepts.adoc index 628a513910d..0071fc081e6 100644 --- a/jekyll/_cci2/concepts.adoc +++ b/jekyll/_cci2/concepts.adoc @@ -281,9 +281,9 @@ jobs: build2: machine: # Specifies a machine image that uses # an Ubuntu version 20.04 image with Docker 20.10.12 - # and docker-compose 1.29.2, follow CircleCI Discuss Announcements + # and docker compose 1.29.2, follow CircleCI Discuss Announcements # for new image releases. - image: ubuntu-2004:202201-02 + image: ubuntu-2004:current steps: - checkout @@ -410,7 +410,7 @@ See the xref:jobs-steps#[Jobs and steps] page for more information. [#orbs] == Orbs -Orbs are reusable snippets of code that help automate repeated processes, accelerate project setup, and make it straight forward to integrate with third-party tools. +Orbs are reusable snippets of code that help automate repeated processes, accelerate project setup, and help you to integrate with third-party tools. The illustration in the <> section showing an example Java configuration could be simplified using orbs. The following illustration demonstrates a simplified configuration with link:https://circleci.com/developer/orbs/orb/circleci/maven[the Maven orb]. Here, the orb sets up a default executor that can execute steps with Maven and run a common job (`maven/test`). diff --git a/jekyll/_cci2/docker-compose.md b/jekyll/_cci2/docker-compose.md index 80e67ec75ec..fd86a730056 100644 --- a/jekyll/_cci2/docker-compose.md +++ b/jekyll/_cci2/docker-compose.md @@ -6,44 +6,56 @@ contentTags: platform: - Cloud - Server v4.x - - Server v3.x --- -This document describes how to install and use Docker Compose, and assumes the reader has some experience using the `docker-compose` utility. +This page describes how to use Docker Compose in your CircleCI pipelines. -If you are new to Docker Compose, do consider reviewing the [official Docker Compose overview](https://docs.docker.com/compose/), or checking out the [Getting Started guide](https://docs.docker.com/compose/gettingstarted/). +If you are new to Docker Compose, you can review the [official Docker Compose overview](https://docs.docker.com/compose/), or checking out the [Getting Started guide](https://docs.docker.com/compose/gettingstarted/). -* TOC -{:toc} +## Using Docker Compose with machine executor +{: #using-docker-compose-with-machine-executor } + +If you want to use Docker Compose to manage a multi-container setup with a Docker Compose file, use the `machine` key in your `.circleci/config.yml` file and use `docker compose` as you would normally (see Linux VM execution environment documentation [here]({{site.baseurl}}/using-linuxvm) for more details). That is, if you have a Docker Compose file that shares local directories with a container, this will work as expected. + + +## Using Docker Compose with docker executor +{: #using-docker-compose-with-docker-executor } + +Using the `docker` execution environment combined with `setup_remote_docker` provides a remote engine similar to the one created with running Docker commands and the machine execution environment, but volume mounting and port forwarding do **not** work the same way in this setup. The remote docker daemon runs on a different system than the docker CLI and docker compose, so you must move data around to make this work. Mounting can usually be solved by making content available in a docker volume. It is possible to load data into a Docker volume by using `docker cp` to get the data from the CLI host into a container running on the docker remote host. + +## Install Docker Compose -The `docker compose` utility is [pre-installed in the CircleCI convenience +The Docker Compose utility is [pre-installed in the CircleCI convenience images]({{ site.baseurl }}/circleci-images/#pre-installed-tools) and machine executor images. -If you are using the Docker executor and **are not** using a convenience image, you can install Docker Compose into your [primary container]({{ site.baseurl }}/glossary/#primary-container) during the job execution with the Remote Docker Environment activated by adding the following to your [`.circleci/config.yml`]({{ site.baseurl }}/configuration-reference/) file: +If you are using the Docker executor and **are not** using a convenience image, you can install Docker Compose into your [primary container]({{ site.baseurl }}/glossary/#primary-container) during the job execution and use the xref:building-docker-images#[Remote Docker Environment], as follows: ```yml - run: name: Install Docker Compose - environment: - COMPOSE_VERSION: 'v2.25.0' command: | - curl -sSL "https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o ~/docker-compose - mkdir -p ~/.docker/cli-plugins - chmod +x ~/docker-compose - mv ~/docker-compose ~/.docker/cli-plugins/docker-compose + # Add Docker's official GPG key: + apt-get update + DEBIAN_FRONTEND=noninteractive apt-get install -y ca-certificates curl + install -m 0755 -d /etc/apt/keyrings + curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc + chmod a+r /etc/apt/keyrings/docker.asc + + # Add the repository to Apt sources: + echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ + $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ + sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + apt-get update + DEBIAN_FRONTEND=noninteractive apt-get install docker-ce-cli docker-buildx-plugin docker-compose-plugin + + - setup_remote_docker #activate the remote docker environment ``` -The above code example assumes that you will also have `curl` available in your -executor. If you are constructing your own docker images, consider reading the -[custom docker images document]({{site.baseurl}}/custom-images/). - -Then, to activate the Remote Docker Environment, add the `setup_remote_docker` step: - -```yml - - setup_remote_docker -``` +If you are constructing your own Docker images, consider reading the +[custom docker images page]({{site.baseurl}}/custom-images/). -This step enables you to run `docker compose` commands to build images: +Once you have Docker Compose installed, you can use it to build images and run containers: ```yml - run: @@ -63,7 +75,7 @@ Or to also verify if a service is running for example: ```yml - run: - name: Start docker compose and verify service(s) + name: Start Docker Compose and verify service(s) command: | # Setting the Docker Compose project name to "circleci-demo-docker" means # the names of our services' containers would be prefixed with "circleci-demo-docker". @@ -85,19 +97,6 @@ See the [Example docker-compose Project](https://github.com/circleci/cci-demo-do **Note**: The primary container runs in a separate environment from Remote Docker and the two cannot communicate directly. To interact with a running service, run a container in the service's network. -## Using Docker Compose with machine executor -{: #using-docker-compose-with-machine-executor } - -If you want to use Docker Compose to manage a multi-container setup with a Docker Compose file, use the `machine` key in your `.circleci/config.yml` file and use `docker compose` as you would normally (see Linux VM execution environment documentation [here]({{site.baseurl}}/using-linuxvm) for more details). That is, if you have a Docker Compose file that shares local directories with a container, this will work as expected. Refer to Docker's documentation of [Your first docker-compose.yml file](https://docs.docker.com/get-started/part3/#your-first-docker-composeyml-file) for details. - - -## Using Docker Compose with docker executor -{: #using-docker-compose-with-docker-executor } - -Using `docker` combined with `setup_remote_docker` provides a remote engine similar to the one created with docker-machine, but volume mounting and port forwarding do **not** work the same way in this setup. The remote docker daemon runs on a different system than the docker CLI and docker compose, so you must move data around to make this work. Mounting can usually be solved by making content available in a docker volume. It is possible to load data into a docker volume by using `docker cp` to get the data from the CLI host into a container running on the docker remote host. - -This combination is required if you want to build docker images for deployment. - ## Limitations {: #limitations } @@ -107,5 +106,4 @@ See [our support article for more information](https://support.circleci.com/hc/e ## See also {: #see-also } - [Running Docker Commands]({{site.baseurl}}/building-docker-images/) diff --git a/jekyll/_cci2/private-images.adoc b/jekyll/_cci2/private-images.adoc index 53c21e3898b..fbdd413e557 100644 --- a/jekyll/_cci2/private-images.adoc +++ b/jekyll/_cci2/private-images.adoc @@ -3,7 +3,7 @@ contentTags: platform: - Cloud --- -= Using Docker Authenticated Pulls += Using Docker authenticated pulls :page-layout: classic-docs :page-liquid: :page-description: This document describes how to authenticate with your Docker registry provider to pull images. @@ -116,7 +116,7 @@ jobs: resource_class: large working_directory: ~/my_app steps: - # Docker is preinstalled, along with docker-compose + # Docker is preinstalled, along with docker compose - checkout # start proprietary DB using private Docker image diff --git a/jekyll/_cci2/using-docker.adoc b/jekyll/_cci2/using-docker.adoc index 676fae328c3..e9e1ff61d6e 100644 --- a/jekyll/_cci2/using-docker.adoc +++ b/jekyll/_cci2/using-docker.adoc @@ -115,7 +115,7 @@ Docker also has built-in image caching and enables you to build, run, and publis * Your application is self-sufficient. * Your application requires additional services to be tested. * Your application is distributed as a Docker image (requires using xref:building-docker-images#[Remote Docker]). -* You want to use `docker-compose` (requires using xref:building-docker-images#[Remote Docker]). +* You want to use `docker compose` (requires using xref:building-docker-images#[Remote Docker]). Choosing Docker limits your runs to what is possible from within a Docker container (including our xref:building-docker-images#[Remote Docker] feature). For instance, if you require low-level access to the network or need to mount external volumes, consider using `machine`. diff --git a/styles/config/vocabularies/Docs/accept.txt b/styles/config/vocabularies/Docs/accept.txt index 9e9f03d1cc3..8464917c4a1 100644 --- a/styles/config/vocabularies/Docs/accept.txt +++ b/styles/config/vocabularies/Docs/accept.txt @@ -43,6 +43,7 @@ autogenerated [Au]toscal[e|er|ing] AWS AWS Certificate Manager +AWS\sECR Azure backoff [Bb]anlist? @@ -99,6 +100,7 @@ Django DLC DNS Docker +Docker\sHub Dockerfiles? [Dd]otfile [Ee]nablement