diff --git a/_includes/deploy.md b/_includes/deploy.md new file mode 100644 index 0000000000..026e90452a --- /dev/null +++ b/_includes/deploy.md @@ -0,0 +1,30 @@ + + +Now, that we have configured a CI/CD pipleline, let's look at how we can deploy the application. Docker supports deploying containers on Azure ACI and AWS ECS. You can also deploy your application to Kubernetes if you have enabled Kubernetes in Docker Desktop. + +## Docker and Azure ACI + +The Docker Azure Integration enables developers to use native Docker commands to run applications in Azure Container Instances (ACI) when building cloud-native applications. The new experience provides a tight integration between Docker Desktop and Microsoft Azure allowing developers to quickly run applications using the Docker CLI or VS Code extension, to switch seamlessly from local development to cloud deployment. + +For detailed instructions, see [Deploying Docker containers on Azure](/cloud/aci-integration/). + +## Docker and AWS ECS + +The Docker ECS Integration enables developers to use native Docker commands in Docker Compose CLI to run applications in Amazon EC2 Container Service (ECS) when building cloud-native applications. + +The integration between Docker and Amazon ECS allows developers to use the Docker Compose CLI to set up an AWS context in one Docker command, allowing you to switch from a local context to a cloud context and run applications quickly and easily simplify multi-container application development on Amazon ECS using Compose files. + +For detailed instructions, see [Deploying Docker containers on ECS](/cloud/ecs-integration/). + +## Kubernetes + +Docker Desktop includes a standalone Kubernetes server and client, as well as Docker CLI integration that runs on your machine. When you enable Kubernetes, you can test your workloads on Kubernetes. + +To enable Kubernetes: + +1. From the Docker menu, select **Preferences** (**Settings** on Windows). +2. Select **Kubernetes** and click **Enable Kubernetes**. + + This starts a Kubernetes single-node cluster when Docker Desktop starts. + +For detailed information, see [Deploy on Kubernetes](/desktop/kubernetes/) and [Describing apps using Kubernetes YAML](/get-started/kube-deploy/#describing-apps-using-kubernetes-yaml). diff --git a/buildx/working-with-buildx.md b/buildx/working-with-buildx.md index 98a61b9354..f4b374e2d6 100644 --- a/buildx/working-with-buildx.md +++ b/buildx/working-with-buildx.md @@ -7,18 +7,33 @@ keywords: Docker, buildx, multi-arch ## Overview Docker Buildx is a CLI plugin that extends the docker command with the full -support of the features provided by [Moby BuildKit](https://github.com/moby/buildkit) +support of the features provided by [Moby BuildKit](https://github.com/moby/buildkit){:target="_blank" rel="noopener" class="_"} builder toolkit. It provides the same user experience as docker build with many -new features like creating scoped builder instances and building against multiple -nodes concurrently. +new features like creating scoped builder instances and building against +multiple nodes concurrently. ## Install -Docker Buildx is included in Docker Desktop and Docker Linux packages when installed -using the [DEB or RPM packages](../engine/install/index.md). +Docker Buildx is included in Docker Desktop and Docker Linux packages when +installed using the [DEB or RPM packages](../engine/install/index.md). You can also download the latest `buildx` binary from the -[Docker buildx](https://github.com/docker/buildx/) repository on GitHub. +[Docker buildx](https://github.com/docker/buildx/releases/latest){:target="_blank" rel="noopener" class="_"} releases page +on GitHub, copy it to `~/.docker/cli-plugins` folder with name +`docker-buildx` and change the permission to execute: + +```console +$ chmod a+x ~/.docker/cli-plugins/docker-buildx +``` + +Here is how to use buildx inside a Dockerfile through the +[`docker/buildx-bin`](https://hub.docker.com/r/docker/buildx-bin) image: + +```dockerfile +FROM docker +COPY --from=docker/buildx-bin /buildx /usr/libexec/docker/cli-plugins/docker-buildx +RUN docker buildx version +``` ## Set buildx as the default builder @@ -63,9 +78,9 @@ with `--output`. ## Work with builder instances -By default, Buildx uses the "docker" driver if it is supported, providing a user -experience very similar to the native docker build. Note that you must use a local -shared daemon to build your applications. +By default, Buildx uses the `docker` driver if it is supported, providing a user +experience very similar to the native `docker build`. Note that you must use a +local shared daemon to build your applications. Buildx allows you to create new instances of isolated builders. You can use this to get a scoped environment for your CI builds that does not change the state of @@ -91,9 +106,9 @@ builder. Docker also features a [`docker context`](../engine/reference/commandline/context.md) command that you can use to provide names for remote Docker API endpoints. Buildx -integrates with docker context to ensure all the contexts automatically get a +integrates with `docker context` to ensure all the contexts automatically get a default builder instance. You can also set the context name as the target when -you create a new builder instance or when you add a node to it. +you create a new builder instance or when you add a node to it. ## Build multi-platform images @@ -105,7 +120,7 @@ When you invoke a build, you can set the `--platform` flag to specify the target platform for the build output, (for example, `linux/amd64`, `linux/arm64`, or `darwin/amd64`). -When the current builder instance is backed by the "docker-container" driver, +When the current builder instance is backed by the `docker-container` driver, you can specify multiple platforms together. In this case, it builds a manifest list which contains images for all specified architectures. When you use this image in [`docker run`](../engine/reference/commandline/run.md) or @@ -126,11 +141,24 @@ are available. When BuildKit needs to run a binary for a different architecture, it automatically loads it through a binary registered in the `binfmt_misc` handler. +For QEMU binaries registered with `binfmt_misc` on the host OS to work +transparently inside containers they must be registered with the `fix_binary` +flag. This requires a kernel >= 4.8 and binfmt-support >= 2.1.7. You can check +for proper registration by checking if `F` is among the flags in +`/proc/sys/fs/binfmt_misc/qemu-*`. While Docker Desktop comes preconfigured +with `binfmt_misc` support for additional platforms, for other installations +it likely needs to be installed using [`tonistiigi/binfmt`](https://github.com/tonistiigi/binfmt){:target="_blank" rel="noopener" class="_"} +image. + +```console +$ docker run --privileged --rm tonistiigi/binfmt --install all +``` + Using multiple native nodes provide better support for more complicated cases that are not handled by QEMU and generally have better performance. You can add additional nodes to the builder instance using the `--append` flag. -Assuming contexts node-amd64 and node-arm64 exist in `docker context ls`; +Assuming contexts `node-amd64` and `node-arm64` exist in `docker context ls`; ```console $ docker buildx create --use --name mybuild node-amd64 @@ -172,3 +200,10 @@ command called [`docker buildx bake`](../engine/reference/commandline/buildx_bak The `bake` command supports building images from compose files, similar to [`docker-compose build`](../compose/reference/build.md), but allowing all the services to be built concurrently as part of a single request. + +There is also support for custom build rules from HCL/JSON files allowing +better code reuse and different target groups. The design of bake is in very +early stages and we are looking for feedback from users. Let us know your +feedback by creating an issue in the +[Docker buildx](https://github.com/docker/buildx/issues){:target="_blank" rel="noopener" class="_"} +GitHub repository. diff --git a/language/golang/configure-ci-cd.md b/language/golang/configure-ci-cd.md index dfeb346d7d..247a8d8551 100644 --- a/language/golang/configure-ci-cd.md +++ b/language/golang/configure-ci-cd.md @@ -175,7 +175,7 @@ jobs: with: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - + - name: Install Go uses: actions/setup-go@v2 with: @@ -195,7 +195,7 @@ jobs: uses: docker/build-push-action@v2 with: push: true - tags: ${{ github.repository }}:latest + tags: ${{ secrets.DOCKER_HUB_USERNAME }}/${{ github.event.repository.name }}:latest - name: Image digest run: echo ${{ steps.docker_build.outputs.digest }} @@ -336,13 +336,13 @@ GitHub Actions are an immensely powerful way to automate your CI and CD pipeline ## Next steps -In this module, you have learnt how to set up GitHub Actions workflow to an existing dockerized Go project, optimize your workflow to improve build times and reduce the number of pull requests, and finally, we learnt how to push only specific versions to Docker Hub. +In this module, you have learnt how to set up GitHub Actions workflow to an existing dockerized Go project, optimize your workflow to improve build times and reduce the number of pull requests, and finally, we learnt how to push only specific versions to Docker Hub. -You can also consider deploying your application to a public Cloud provider, such as Azure and AWS. +You can also consider deploying your application to a public Cloud provider, such as Azure and AWS or to an orchestration platform such as Kubernetes. In the next module, we’ll look into some options for doing so: -[Deploy to the Cloud](deploy.md){: .button .outline-btn} +[Deploy your app](deploy.md){: .button .outline-btn} ## Feedback diff --git a/language/golang/deploy.md b/language/golang/deploy.md index 8b31a54bf2..1e4f2e17e2 100644 --- a/language/golang/deploy.md +++ b/language/golang/deploy.md @@ -1,26 +1,12 @@ --- -title: "Configure CI/CD for your application" -keywords: CI/CD, GitHub Actions, Go, Golang, cloud, deployment -description: Learn how to deploy your application to the Cloud. +title: "Deploy your app" +keywords: deploy, ACI, ECS, local, development, Go, Golang, cloud, deployment +description: Learn how to deploy your application --- {% include_relative nav.html selected="6" %} -Now, that we have configured a CI/CD pipleline, let's look at how we can deploy the application to cloud. Docker supports deploying containers on Azure ACI and AWS ECS. - -## Docker and Azure ACI - -The Docker Azure Integration enables developers to use native Docker commands to run applications in Azure Container Instances (ACI) when building cloud-native applications. The new experience provides a tight integration between Docker Desktop and Microsoft Azure allowing developers to quickly run applications using the Docker CLI or VS Code extension, to switch seamlessly from local development to cloud deployment. - -For detailed instructions, see [Deploying Docker containers on Azure](../../cloud/aci-integration.md). - -## Docker and AWS ECS - -The Docker ECS Integration enables developers to use native Docker commands in Docker Compose CLI to run applications in Amazon EC2 Container Service (ECS) when building cloud-native applications. - -The integration between Docker and Amazon ECS allows developers to use the Docker Compose CLI to set up an AWS context in one Docker command, allowing you to switch from a local context to a cloud context and run applications quickly and easily simplify multi-container application development on Amazon ECS using Compose files. - -For detailed instructions, see [Deploying Docker containers on ECS](../../cloud/ecs-integration.md). +{% include deploy.md %} ## Feedback diff --git a/language/java/configure-ci-cd.md b/language/java/configure-ci-cd.md index a64711d53a..28b4fc217f 100644 --- a/language/java/configure-ci-cd.md +++ b/language/java/configure-ci-cd.md @@ -289,9 +289,9 @@ java-docker jdk 4c15436d8ab7 5 hours ago 567MB In this module, you have learnt how to set up GitHub Actions workflow to an existing Docker project, optimize your workflow to improve build times and reduce the number of pull requests, and finally, we learnt how to push only specific versions to Docker Hub. You can also set up nightly tests against the latest tag, test each PR, or do something more elegant with the tags we are using and make use of the Git tag for the same tag in our image. -You can also consider deploying your application to the cloud. For detailed instructions, see: +You can also consider deploying your application. For detailed instructions, see: -[Deploy your application to the cloud](deploy.md){: .button .primary-btn} +[Deploy your application](deploy.md){: .button .primary-btn} ## Feedback diff --git a/language/java/deploy.md b/language/java/deploy.md index 7decc84820..57f421e9b2 100644 --- a/language/java/deploy.md +++ b/language/java/deploy.md @@ -1,26 +1,12 @@ --- -title: "Deploy your app to the cloud" +title: "Deploy your app" keywords: deploy, ACI, ECS, Java, local, development -description: Learn how to deploy your application to the cloud. +description: Learn how to deploy your application --- {% include_relative nav.html selected="6" %} -Now, that we have configured a CI/CD pipleline, let's look at how we can deploy the application to cloud. Docker supports deploying containers on Azure ACI and AWS ECS. - -## Docker and ACI - -The Docker Azure Integration enables developers to use native Docker commands to run applications in Azure Container Instances (ACI) when building cloud-native applications. The new experience provides a tight integration between Docker Desktop and Microsoft Azure allowing developers to quickly run applications using the Docker CLI or VS Code extension, to switch seamlessly from local development to cloud deployment. - -For detailed instructions, see [Deploying Docker containers on Azure](../../cloud/aci-integration.md). - -## Docker and ECS - -The Docker ECS Integration enables developers to use native Docker commands in Docker Compose CLI to run applications in Amazon EC2 Container Service (ECS) when building cloud-native applications. - -The integration between Docker and Amazon ECS allows developers to use the Docker Compose CLI to set up an AWS context in one Docker command, allowing you to switch from a local context to a cloud context and run applications quickly and easily simplify multi-container application development on Amazon ECS using Compose files. - -For detailed instructions, see [Deploying Docker containers on ECS](../../cloud/ecs-integration.md). +{% include deploy.md %} ## Feedback diff --git a/language/nodejs/build-images.md b/language/nodejs/build-images.md index f65a2e3f70..9afa895ce6 100644 --- a/language/nodejs/build-images.md +++ b/language/nodejs/build-images.md @@ -3,7 +3,7 @@ title: "Build your Node image" keywords: containers, images, node.js, node, dockerfiles, node, coding, build, push, run description: Learn how to build your first Docker image by writing a Dockerfile redirect_from: -- /get-started/nodejs/build-images/ + - /get-started/nodejs/build-images/ --- {% include_relative nav.html selected="1" %} @@ -40,12 +40,12 @@ Now, let’s add some code to handle our REST requests. We’ll use a mock serve Open this working directory in your IDE and add the following code into the `server.js` file. ```js -const ronin = require( 'ronin-server' ) -const mocks = require( 'ronin-mocks' ) +const ronin = require('ronin-server') +const mocks = require('ronin-mocks') const server = ronin.server() -server.use( '/', mocks.server( server.Router(), false, true ) ) +server.use('/', mocks.server(server.Router(), false, true)) server.start() ``` @@ -139,13 +139,14 @@ WORKDIR /app Usually the very first thing you do once you’ve downloaded a project written in Node.js is to install npm packages. This ensures that your application has all its dependencies installed into the `node_modules` directory where the Node runtime will be able to find them. -Before we can run `npm install`, we need to get our `package.json` and `package-lock.json` files into our images. We use the `COPY` command to do this. The `COPY` command takes two parameters. The first parameter tells Docker what file(s) you would like to copy into the image. The second parameter tells Docker where you want that file(s) to be copied to. We’ll copy the `package.json` and `package-lock.json` file into our working directory `/app`. +Before we can run `npm install`, we need to get our `package.json` and `package-lock.json` files into our images. We use the `COPY` command to do this. The `COPY` command takes two parameters. The first parameter tells Docker what file(s) you would like to copy into the image. The second parameter tells Docker where you want that file(s) to be copied to. We’ll copy the `package.json` and `package-lock.json` file into our working directory `/app`. ```dockerfile COPY ["package.json", "package-lock.json*", "./"] ``` -Once we have our `package.json` files inside the image, we can use the `RUN` command to execute the command npm install. This works exactly the same as if we were running npm install locally on our machine, but this time these Node modules will be installed into the `node_modules` directory inside our image. +Note that, rather than copying the entire working directory, we are only copying the package.json file. This allows us to take advantage of cached Docker layers. +Once we have our files inside the image, we can use the `RUN` command to execute the command npm install. This works exactly the same as if we were running npm install locally on our machine, but this time these Node modules will be installed into the `node_modules` directory inside our image. ```dockerfile RUN npm install --production diff --git a/language/nodejs/configure-ci-cd.md b/language/nodejs/configure-ci-cd.md index 9d3af463ed..8da2eaef0f 100644 --- a/language/nodejs/configure-ci-cd.md +++ b/language/nodejs/configure-ci-cd.md @@ -231,9 +231,9 @@ Now, we will have two different flows: one for our changes to master, and one fo In this module, you have learnt how to set up GitHub Actions workflow to an existing Docker project, optimize your workflow to improve build times and reduce the number of pull requests, and finally, we learnt how to push only specific versions to Docker Hub. You can also set up nightly tests against the latest tag, test each PR, or do something more elegant with the tags we are using and make use of the Git tag for the same tag in our image. -You can also consider deploying your application to the cloud. For detailed instructions, see: +You can also consider deploying your application. For detailed instructions, see: -[Deploy your app to the cloud](/deploy.md){: .button .primary-btn} +[Deploy your app](/deploy.md){: .button .primary-btn} ## Feedback diff --git a/language/nodejs/deploy.md b/language/nodejs/deploy.md index a1c94e617a..c04ea5623f 100644 --- a/language/nodejs/deploy.md +++ b/language/nodejs/deploy.md @@ -1,26 +1,12 @@ --- -title: "Deploy your app to the cloud" +title: "Deploy your app" keywords: deploy, cloud, ACI, ECS, NodeJS, local, development -description: Learn how to deploy your application to the cloud +description: Learn how to deploy your application --- {% include_relative nav.html selected="6" %} -Now, that we have configured a CI/CD pipleline, let's look at how we can deploy the application to cloud. Docker supports deploying containers on Azure ACI and AWS ECS. - -## Docker and ACI - -The Docker Azure Integration enables developers to use native Docker commands to run applications in Azure Container Instances (ACI) when building cloud-native applications. The new experience provides a tight integration between Docker Desktop and Microsoft Azure allowing developers to quickly run applications using the Docker CLI or VS Code extension, to switch seamlessly from local development to cloud deployment. - -For detailed instructions, see [Deploying Docker containers on Azure](../../cloud/aci-integration.md). - -## Docker and ECS - -The Docker ECS Integration enables developers to use native Docker commands in Docker Compose CLI to run applications in Amazon EC2 Container Service (ECS) when building cloud-native applications. - -The integration between Docker and Amazon ECS allows developers to use the Docker Compose CLI to set up an AWS context in one Docker command, allowing you to switch from a local context to a cloud context and run applications quickly and easily simplify multi-container application development on Amazon ECS using Compose files. - -For detailed instructions, see [Deploying Docker containers on ECS](../../cloud/ecs-integration.md). +{% include deploy.md %} ## Feedback diff --git a/language/python/configure-ci-cd.md b/language/python/configure-ci-cd.md index a0046bd815..2da21b6e7e 100644 --- a/language/python/configure-ci-cd.md +++ b/language/python/configure-ci-cd.md @@ -231,9 +231,9 @@ Now, we will have two different flows: one for our changes to master, and one fo In this module, you have learnt how to set up GitHub Actions workflow to an existing Docker project, optimize your workflow to improve build times and reduce the number of pull requests, and finally, we learnt how to push only specific versions to Docker Hub. You can also set up nightly tests against the latest tag, test each PR, or do something more elegant with the tags we are using and make use of the Git tag for the same tag in our image. -You can also consider deploying your application to the cloud. For detailed instructions, see: +You can also consider deploying your application. For detailed instructions, see: -[Deploy your application to the cloud](deploy.md){: .button .primary-btn} +[Deploy your app](deploy.md){: .button .primary-btn} ## Feedback diff --git a/language/python/deploy.md b/language/python/deploy.md index 2b7f33d740..7955311ab7 100644 --- a/language/python/deploy.md +++ b/language/python/deploy.md @@ -1,26 +1,12 @@ --- -title: "Deploy your app to the cloud" +title: "Deploy your app" keywords: deploy, ACI, ECS, Python, local, development -description: Learn how to deploy your application to the cloud. +description: Learn how to deploy your application --- {% include_relative nav.html selected="5" %} -Now, that we have configured a CI/CD pipleline, let's look at how we can deploy the application to cloud. Docker supports deploying containers on Azure ACI and AWS ECS. - -## Docker and ACI - -The Docker Azure Integration enables developers to use native Docker commands to run applications in Azure Container Instances (ACI) when building cloud-native applications. The new experience provides a tight integration between Docker Desktop and Microsoft Azure allowing developers to quickly run applications using the Docker CLI or VS Code extension, to switch seamlessly from local development to cloud deployment. - -For detailed instructions, see [Deploying Docker containers on Azure](../../cloud/aci-integration.md). - -## Docker and ECS - -The Docker ECS Integration enables developers to use native Docker commands in Docker Compose CLI to run applications in Amazon EC2 Container Service (ECS) when building cloud-native applications. - -The integration between Docker and Amazon ECS allows developers to use the Docker Compose CLI to set up an AWS context in one Docker command, allowing you to switch from a local context to a cloud context and run applications quickly and easily simplify multi-container application development on Amazon ECS using Compose files. - -For detailed instructions, see [Deploying Docker containers on ECS](../../cloud/ecs-integration.md). +{% include deploy.md %} ## Feedback