Vue normale

Il y a de nouveaux articles disponibles, cliquez pour rafraîchir la page.
À partir d’avant-hierFlux principal

Streamline Dockerization with Docker Init GA

Par : Nuno Coracao
6 février 2024 à 15:27

In May 2023, Docker announced the beta release of docker init, a new command-line interface (CLI) tool in Docker Desktop designed to streamline the Docker setup process for various types of applications and help users containerize their existing projects. We’re now excited to announce the general availability of docker init, with support for multiple languages and stacks, making it simpler than ever to containerize your applications.

banner Streamline Dockerization with the GA of ‘docker init 2400x1260

What is docker init?

Initially released in its beta form in Docker 4.18, docker init has undergone several enhancements. docker init is a command-line utility that aids in the initialization of Docker resources within a project. It automatically generates Dockerfiles, Compose files, and .dockerignore files based on the nature of the project, significantly reducing the setup time and complexity associated with Docker configurations. 

The initial beta release of init came with support only for Go and generic projects. The latest version, available in Docker Desktop 4.27, supports Go, Python, Node.js, Rust, ASP.NET, PHP, and Java.

How to use docker init

Using docker init is straightforward and involves a few simple steps. Start by navigating to your project directory where you want the Docker assets to be initialized. In the terminal, execute the docker init command. This command initiates the tool and prepares it to analyze your project (Figure 1).

Screenshot of Docker init welcome message, with suggestions to help you choose a template for your project.
Figure 1: Docker init will suggest the best template for the application.

docker init will scan your project and ask you to confirm and choose the template that best suits your application. Once you select the template, docker init asks you for some project-specific information, automatically generating the necessary Docker resources for your project (Figure 2).

Screenshot of docker init in action. Once you choose a template, docker init will automatically generate the necessary Docker resources.
Figure 2. Once a template is applied, you’ll be ready to run your application with Compose.

This step includes creating a Dockerfile and a Compose file tailored to the language and framework of your choice, as well as other relevant files. The last step is to run docker compose up to start your newly containerized project.

Why use docker init?

The docker init tool simplifies the process of dockerization, making it accessible even to those new to Docker. It eliminates the need to manually write Dockerfiles and other configuration files from scratch, saving time and reducing the potential for errors. With its template-based approach, docker init ensures that the Docker setup is optimized for the specific type of application you are working on and that your project will follow the industry’s best practices.

Conclusion

The general availability of docker init offers an efficient and user-friendly way to integrate Docker into your projects. Whether you’re a seasoned Docker user or new to containerization, docker init is set to enhance your development workflow. 

Learn more 

New to Docker? Start by downloading Docker Desktop.

Watch the following video tutorials for further insight on leveraging docker init

Learn how to use Docker init using your favorite language:

Docker Desktop 4.23: Updates to Docker Init, New Configuration Integrity Check, Quick Search Improvements, Performance Enhancements, and More

Par : Nuno Coracao
12 septembre 2023 à 18:25

Docker Desktop 4.23 is now available and includes numerous enhancements, including ASP.NET Core support in Docker Init, Configuration Integrity Check to alert on any configuration changes that require attention, and cross-domain identity management. This release also improves Quick Search, allowing for searching across containers, apps, Docker Hub, Docs, and any volume, and performing quick actions (start/stop/delete). VirtioFS is now set to default to provide performance gains for Mac users. With the Docker Desktop 4.23 release, Mac users will also see increased network performance using traditional network connections. 

In this post, we dive into what’s new and updated in the latest release of Docker Desktop.

banner 4.23 docker desktop

ASP.NET Core with Docker Init

We are excited to announce added support for ASP.NET Core. Whether you’re new to Docker or a seasoned pro, Docker Init now streamlines Dockerization for your ASP.NET Core projects. With a simple docker init command in your project folder and the latest Docker Desktop version, watch as Docker Init generates tailored Dockerfiles, Compose files, and .dockerignore files.

Docker Init showing available languages, now including ASP.NET.
Figure 1: Docker Init showing available languages, now including ASP.NET Core.

Specific to ASP.NET Core, we also improved support and comments in the DockerFile for multi-arch builds. This advancement will help users manage sharing their images across different CPU architectures and streamline deployments on cloud providers such as Azure, AWS, and GCP. Create images that fit various architectures, boosting flexibility and efficiency in cloud deployments.

Get started by ensuring you have the latest Docker Desktop version. Then, execute docker init in your project directory through the command line. Let Docker Init handle the heavy lifting, allowing you to concentrate on your core task — crafting outstanding applications!

Configuration Integrity Check

Ensure Docker Desktop runs smoothly with our new Configuration Integrity Check. This allows you to keep using multiple local applications and tools, sometimes making configuration changes hassle-free. This update automatically detects and alerts to any configuration changes, prompting a simple click and re-establishing Docker Desktop configurations to track and ensure uninterrupted development.

Alerts to any configuration issues will be displayed in the whale menu.

Cross-domain identity management 

User access management for Docker just got more powerful. SCIM helps auto-provision or de-provision users, and group role mapping is now supported so you can organize your teams and their access accordingly: 

  • You can assign roles to members in your organization in the IdP. To set up a role, you can use optional user-level attributes for the person you want to assign a role. 
  • You can also set an organization and team to override the default provisioning values set by the SSO connection.
  • The following table lists the supported optional user-level attributes.
The logic used for defining user access control.
Figure 2: The logic used for defining user access control.

Improvements to Quick Search 

Empowering developers with seamless access to essential resources whenever they’re needed, our revamped Quick Search feature has received significant upgrades. Now, users can effortlessly locate:

  • Containers and Compose apps: Easily pinpoint any container or Compose app residing on your local system. Additionally, gain quick access to environment variables and perform essential actions such as starting, stopping, or deleting them.
  • Docker Hub images: Whether it’s public Docker Hub images, local ones, or those from remote repositories, Quick Search will provide fast and relevant results.
  • Extensions: Discover more about specific extensions and streamline installation with a single click.
  • Volumes: Effortlessly navigate through your volumes and gain insights into the associated containers.
  • Documentation: Instantly access invaluable assistance from Docker’s official documentation, all directly from within Docker Desktop.

Enhanced Quick Search is your ultimate tool for resource discovery and management, offering unmatched convenience for developers.

Search results with updated Quick Search within Docker Desktop 4.23.
Figure 3: Search results with updated Quick Search within Docker Desktop 4.23.

Standardizing higher performance file sharing with VirtioFS for Mac users

Docker Desktop 4.23 now defaults to utilizing VirtioFS on macOS 12.5+ as the standard to deliver substantial performance gains when sharing files with containers through docker run -v or bind mounts in Compose YAML. VirtioFS minimizes file transfer overhead by allowing containers to access files without volume mounts or network shares.

Setting VirtuoFS to default in the Docker Desktop General settings.
Figure 4: Setting VirtuoFS to default in the Docker Desktop General settings.

Skipping network file transfer protocols also leads to faster file transfers. We measured performance improvements, decreasing file transfer time from 7:13.21s to 1:4.4s — an 85.15% increase in speed. We do want to note that the measured improvement depends on the size of the file, what other apps are running, and the hardware of the computer.

Tables showing the transfer speeds of a 10GB file over three runs, before and after using VirtioFS.
Figure 5: Tables showing the transfer speeds of a 10GB file over three runs, before and after using VirtioFS.

Docker Desktop network speed improvements for Mac users

Docker Desktop 4.23 comes with improved networking performance for Mac users. Now, when a container requires a traditional network connection, users will experience increased network performance in these ways:

  1. Accessing exposed ports ~10x faster
  2. Transmission Control Protocol (TCP)  ~1.5x – 2x faster

No user action is required to experience these benefits — all Mac users updated to 4.23 will now network faster!

Conclusion

Upgrade now to explore what’s new in the 4.23 release of Docker Desktop. Do you have feedback? Leave feedback on our public GitHub roadmap, and let us know what else you’d like to see in upcoming releases.

Learn more

❌
❌