<section class="blog-post-content lb-rtxt"><table id="amazon-polly-audio-table"><tbody><tr><td id="amazon-polly-audio-tab"><p></p></td></tr></tbody></table><p>Starting today, you can use <a href="https://aws.amazon.com/codebuild/">AWS CodeBuild</a> Docker Server capability to provision a dedicated and persistent Docker server directly within your CodeBuild project. With Docker Server capability, you can accelerate your Docker image builds by centralizing image building to a remote host, which reduces wait times and increases overall efficiency.</p><p>From my benchmark, with this Docker Server capability, I reduced the total building time by 98 percent, from 24 minutes and 54 seconds to 16 seconds. Here’s a quick look at this feature from my AWS CodeBuild projects.</p><p><img class="aligncenter size-full wp-image-95729 c4" src="https://d2908q01vomqb2.cloudfront.net/da4b9237bacccdf19c0760cab7aec4a8359010b0/2025/04/30/news-2025-codebuilddockerserver-rev-0.png" alt="" width="2692" height="1035" /></p><p><a href="https://aws.amazon.com/codebuild/">AWS CodeBuild</a> is a fully managed continuous integration service that compiles source code, runs tests, and produces software packages ready for deployment. Building Docker images is one of the most common use cases for CodeBuild customers, and the service has progressively improved this experience over time by releasing features such as <a href="https://docs.aws.amazon.com/codebuild/latest/userguide/build-caching.html">Docker layer caching</a> and <a href="https://docs.aws.amazon.com/codebuild/latest/userguide/fleets.html">reserved capacity features</a> to improve Docker build performance.</p><p>With the new Docker Server capability, you can reduce build time for your applications by providing a persistent Docker server with consistent caching. When enabled in a CodeBuild project, a dedicated Docker server is provisioned with persistent storage that maintains your Docker layer cache. This server can handle multiple concurrent Docker build operations, with all builds benefiting from the same centralized cache.</p><p><strong>Using AWS CodeBuild Docker Server</strong><br />Let me walk you through a demonstration that showcases the benefits with the new Docker Server capability.</p><p>For this demonstration, I’m building a complex, multi-layered Docker image based on the official <a href="https://github.com/aws/aws-codebuild-docker-images/tree/master">AWS CodeBuild curated Docker images repository</a>, specifically the Dockerfile for building a <a href="https://github.com/aws/aws-codebuild-docker-images/tree/master/ubuntu/standard/5.0">standard Ubuntu image</a>. This image contains numerous dependencies and tools required for modern continuous integration and continuous delivery (CI/CD) pipelines, making it a good example of the type of large Docker builds that development teams regularly perform.</p><pre class="language-dockerfile"># Copyright 2020-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.## Licensed under the Amazon Software License (the "License"). You may not use this file except in compliance with the License.# A copy of the License is located at## http://aws.amazon.com/asl/## or in the "license" file accompanying this file.# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied.# See the License for the specific language governing permissions and limitations under the License.FROM public.ecr.aws/ubuntu/ubuntu:20.04 AS coreARG DEBIAN_FRONTEND="noninteractive"# Install git, SSH, Git, Firefox, GeckoDriver, Chrome, ChromeDriver, stunnel, AWS Tools, configure SSM, AWS CLI v2, env tools for runtimes: Dotnet, NodeJS, Ruby, Python, PHP, Java, Go, .NET, Powershell Core, Docker, Composer, and other utilitiesCOMMAND REDACTED FOR BREVITY# Activate runtime versions specific to image version.RUN n $NODE_14_VERSIONRUN pyenv global $PYTHON_39_VERSIONRUN phpenv global $PHP_80_VERSIONRUN rbenv global $RUBY_27_VERSIONRUN goenv global $GOLANG_15_VERSION# Configure SSHCOPY ssh_config /root/.ssh/configCOPY runtimes.yml /codebuild/image/config/runtimes.ymlCOPY dockerd-entrypoint.sh /usr/local/bin/dockerd-entrypoint.shCOPY legal/bill_of_material.txt /usr/share/doc/bill_of_material.txtCOPY amazon-ssm-agent.json /etc/amazon/ssm/amazon-ssm-agent.jsonENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh"]</pre><p>This Dockerfile creates a comprehensive build environment with multiple programming languages, build tools, and dependencies – exactly the type of image that would benefit from persistent caching.</p><p>In the build specification (buildspec), I use the <code>docker buildx build .</code> command:</p><pre class="language-yaml">version: 0.2phases: build: commands: - cd ubuntu/standard/5.0 - docker buildx build -t codebuild-ubuntu:latest .</pre><p>To enable the Docker Server capability, I navigate to the AWS CodeBuild console and select <strong>Create project</strong>. I can also enable this capability when editing existing CodeBuild projects.</p><p><img class="aligncenter size-full wp-image-95616 c4" src="https://d2908q01vomqb2.cloudfront.net/da4b9237bacccdf19c0760cab7aec4a8359010b0/2025/04/28/news-2025-codebuilddockerserver-0.png" alt="" width="3024" height="1716" /></p><p>I fill in all details and configuration. In the <strong>Environment</strong> section, I select <strong>Additional configuration</strong>.</p><p><img class="aligncenter wp-image-95730 size-full c4" src="https://d2908q01vomqb2.cloudfront.net/da4b9237bacccdf19c0760cab7aec4a8359010b0/2025/04/30/news-2025-codebuilddockerserver-rev-1.png" alt="" width="2646" height="3256" /></p><p>Then, I scroll down and find <strong>Docker server configuration</strong> and select <strong>Enable docker server for this project</strong>. When I select this option, I can choose a compute type configuration for the Docker server. When I’m finished with the configurations, I create this project.</p><p><img class="aligncenter wp-image-95833 size-full c4" src="https://d2908q01vomqb2.cloudfront.net/da4b9237bacccdf19c0760cab7aec4a8359010b0/2025/05/03/news-2025-codebuilddockerserver-rev-6.png" alt="" width="917" height="385" /></p><p>Now, let’s see the Docker Server capability in action.</p><p>The initial build takes approximately 24 minutes and 54 seconds to complete because it needs to download and compile all dependencies from scratch. This is expected for the first build of such a complex image.</p><p><img class="aligncenter size-full wp-image-95732 c4" src="https://d2908q01vomqb2.cloudfront.net/da4b9237bacccdf19c0760cab7aec4a8359010b0/2025/04/30/news-2025-codebuilddockerserver-rev-3.png" alt="" width="2708" height="2071" /></p><p>For subsequent builds with no code changes, the build takes only 16 seconds and that shows 98% reduction in build time.</p><p><img class="aligncenter size-full wp-image-95733 c4" src="https://d2908q01vomqb2.cloudfront.net/da4b9237bacccdf19c0760cab7aec4a8359010b0/2025/04/30/news-2025-codebuilddockerserver-rev-4.png" alt="" width="2696" height="2080" /></p><p>Looking at the logs, I can see that with Docker Server, most layers are pulled from the persistent cache:</p><p><img class="aligncenter wp-image-95734 size-full c4" src="https://d2908q01vomqb2.cloudfront.net/da4b9237bacccdf19c0760cab7aec4a8359010b0/2025/04/30/news-2025-codebuilddockerserver-rev-5.png" alt="" width="2664" height="2548" /></p><p>The persistent caching provided by the Docker Server maintains all layers between builds, which is particularly valuable for large, complex Docker images with many layers. This demonstrates how Docker Server can dramatically improve throughput for teams running numerous Docker builds in their CI/CD pipelines.</p><p><strong>Additional things to know</strong><br />Here are a couple of things to note:</p><ul><li><strong>Architecture support</strong> – The feature is available for both x86 (Linux) and ARM builds.</li><li><strong>Pricing</strong> – To learn more about pricing for Docker Server capability, refer to the <a href="https://aws.amazon.com/codebuild/pricing/">AWS CodeBuild pricing</a> page.</li><li><strong>Availability</strong> – This feature is available in all AWS Regions where AWS CodeBuild is offered. For more information about the AWS Regions where CodeBuild is available, see the <a href="https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services/">AWS Regions page</a>.</li></ul><p>You can learn more about the Docker Server feature in the <a href="https://docs.aws.amazon.com/codebuild/latest/userguide/sample-docker-server.html">AWS CodeBuild documentation</a>.</p><p>Happy building! —</p><p><a href="https://linkedin.com/in/donnieprakoso">Donnie Prakoso</a></p><hr /><p>How is the News Blog doing? Take this <a href="https://amazonmr.au1.qualtrics.com/jfe/form/SV_eyD5tC5xNGCdCmi">1 minute survey</a>!</p><p><em>(This <a href="https://amazonmr.au1.qualtrics.com/jfe/form/SV_eyD5tC5xNGCdCmi">survey</a> is hosted by an external company. AWS handles your information as described in the <a href="https://aws.amazon.com/privacy/?trk=4b29643c-e00f-4ab6-ab9c-b1fb47aa1708&amp;sc_channel=blog">AWS Privacy Notice</a>. AWS will own the data gathered via this survey and will not share the information collected with survey respondents.)</em></p></section><aside id="Comments" class="blog-comments"><div data-lb-comp="aws-blog:cosmic-comments" data-env="prod" data-content-id="e3a990c3-4693-4e03-8693-45c739834061" data-title="Accelerate CI/CD pipelines with the new AWS CodeBuild Docker Server capability" data-url="https://aws.amazon.com/blogs/aws/accelerate-ci-cd-pipelines-with-the-new-aws-codebuild-docker-server-capability/"><p data-failed-message="Comments cannot be loaded… Please refresh and try again.">Loading comments…</p></div></aside>