Need to choose the right Docker container for a new project but don’t know where to start? Want to see how your container is built and see what lives inside it? Wondering how you can effectively achieve container best practices (opens new window)?
The Slim Developer Platform allows you to search containers from popular repositories and visualize how they get created. It gives you a great starting point for future optimizations, and can be combined with DockerSlim (opens new window) to create production-ready containers with minimal fuss.
Here’s how to use our web portal.
# 1. Request a beta invite
We’re still in our early days! You’ll need an invite to join the platform. Request one here. (opens new window) And know that privacy and security are founding principles of our business. We take privacy seriously and will guard your information.
# 2. Log in with your beta invite code
Visit portal.slim.dev (opens new window) to get started. Be sure to paste your invite code in the box before logging in! You can log in using your GitHub, GitLab, or BitBucket account.
On successful login, you should see the container search interface. Click on your username to see account information or switch to the Dark Mode UI if that’s your preference. You’ll also notice a Feedback tab on the left — your feedback helps guide our roadmap and we really appreciate it.
# 3. Find a container that fits your project
From the search interface, you can find containers from multiple container registries — including Docker Hub and Quay.io. We will soon launch additional public repositories, including Amazon Elastic Container Registry and Google Container Registry, as well as support for private repositories.
You can look for images to start your project in two ways:
Simply search for a container using our search interface. You can search by container name, tag, or pull command.
We’ve curated a list of images in major subject matter areas to help you find the best images to start your project. We’ll be adding more as we find areas of interest among our developer base, as well as releasing a Collections feature that allows you to create and share a group of your own.
Matching images will appear in a list along with basic metadata and can be filtered by provider (i.e., repository), source (official, third-party, or vendor-provided images), or by your own bookmarks. You can bookmark a container for later use by clicking the bookmark tab in the top right corner of the result. Clear your bookmarks using the “Clear Bookmarks” icon next to the filter icon. NOTE: This will clear ALL of your bookmarks, not just those in the current list.
# 4. Select A Container
Once you’ve found an image that looks interesting, you can select a version from the drop-down to inspect it further.
The Slim Developer Platform will download and analyze the image using our proprietary toolset. The process takes anywhere from 30 seconds to one minute, depending on the size and complexity of the image.
# 5. Overview Page
Once the image is analyzed, you will be brought to an Overview page.
Here, you can find the metadata relating to the image, including links, maintainer info, pull commands, updates, and the uncompressed container size. You’ll also see any ports exposed on the container, ensuring you can access it via usual web access ports (80, 443) or showing assigned ports for application-specific use cases.
# Environment Variables
Scrolling down, you’ll find any and all environment variables used by the container. It’s good to review these. Environment variables offer a low-fidelity “bill of materials” for the image. It often shows major packages (and their version numbers) of the core software in the container. They also list reasonable default values used in the container, such as paths to volumes, that are useful for debugging. Occasionally, you may even catch unexpected or critical security flaws, such as storing passwords or access tokens as publicly consumable environment variables.
If the container relies on a persistent storage volume — this is common in many Data Storage containers like PostgreSQL or MongoDB — you will see them listed in the next section. This is a good indication as to whether the container will persist data upon rebuild or whether it will be erased. Knowing the path to the volume is useful for direct access.
The next sections include the various available versions, including previous versions and, if available, the Alpine Linux version or any maintainer supported “slim” versions that have already been optimized by the maintainers. These images may be more appropriate to your use case, but keep in mind that starting with a bare-bones image may cause headaches later in development.
Finally, you’ll find any public documentation from the image’s README file.
Next, we’ll take a deeper look at the container by clicking the Explorer tab.
# 6. Explorer
In the Explorer tab, you’ll be able to see exactly how an image builds a container.
Select "dark mode" in the username drop-down to see this UI.
Understanding container construction is the single most important step for following container best practices. Optimizing this construction leads to smaller containers with shorter build times, with has long-term benefits for any developer workflow.
Containers have three main elements: Layers, Files, and Instructions. These three elements interact during the build process and ultimately determine what exists inside the final container. Generally, the more layers, files, and instructions your build process containers, the larger, slower, and less secure your resulting container will be.
In the file view, you can see the order in which files are created when building a container from the image. Expanding one of the layer nodes gives you a view of the files generated during the build of that image, along with the instruction associated to that file. For instance, you might be interested to know which version of is used to build your image. You can usually find it in the first layer.
Knowing which files are created in each layer gives you a basic understanding of how efficiently the image is built. Efficient containers will usually have their operating systems and core libraries installed in the early stages, with application code, which is more likely to change, coming in later stages.
Large layers and files are indicated by a red icon and may be worthy of deeper investigation when slimming an image.
Choosing the Layer tab in the Explorer will show you each Layer and various instructions executed at each layer stage. Seeing which instructions run in each layer gives you a better understanding of how layers are being created.
You can find associated files by expanding the command down using the drop-down arrow.
Clicking on an instruction will bring up a tab that gives more information about the layer and its instruction. You can see individual system commands, detailing the various apt-get or CRUD commands the operating system is executing.
Instruction view is a “Dockerfile plus” view of the container build process that shows which instructions in the Dockerfile created which layers and files. This is useful for understanding which commands created which layers when debugging a Dockerfile.
Instructions that create a branch of additional commands and files are indicated by a green lightning bolt and can be expanded to see additional information.
The JSON file will combine process- and container-level metadata with layer, file, and instruction information. The JSON file makes it easier to quick scroll through and search for specifics of the build process that are presented on the other tabs. A quick-search bar in the top right of the file lets you jump to any text string in the file.
Finally, the X-ray Track diagram allows you to visualize the entire container build in an interactive tree diagram. This lets you easily visualize the relationships between instructions, layers, and files. It is the easiest way to understand the high-level relationships between layers, files, and instructions in the construction process.
To make the container easier to visualize, you can adjust the settings using the hamburger menu in the top right corner. Use the slider across the top of the screen to zoom in and out. Select any node to trace the ownership path back to the start of the build. (You can also use your mouse to pan and zoom.)
When done, click the red ‘X’ to exit the modal.
# 7. Docker File
As a final step, the Slim Developer Platform will provide you with a generated Dockerfile. This Dockerfile is for informational purposes only at this time, but helpful to see and understand how our system thinks about the construction of the image.
We're still in our early days of development. Check back soon for more updates from our roadmap, including new features around Collections, file viewing, and private repository connections.
Looking for more tips and tricks to using Slim Developer Platform and DockerSilm? Join our community (opens new window) to connect with other Docker practitioners and get announcements of new features, instructional content on optimizing containers, and free giveaways.
Want to rock some Codi the Cloud swag? Request stickers and more here. (opens new window)