<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Docker archivos &#187; Aprende IT</title>
	<atom:link href="https://aprendeit.com/en/category/docker-en/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>All the latest news about IT</description>
	<lastBuildDate>Tue, 18 Jun 2024 21:54:38 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://aprendeit.com/wp-content/uploads/2020/02/LOGO-CORTO-100x100.png</url>
	<title>Docker archivos &#187; Aprende IT</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Install Your Own Wazuh Server on Ubuntu</title>
		<link>https://aprendeit.com/en/install-your-own-wazuh-server-on-ubuntu/</link>
					<comments>https://aprendeit.com/en/install-your-own-wazuh-server-on-ubuntu/#respond</comments>
		
		<dc:creator><![CDATA[Gerardo G. Urtiaga]]></dc:creator>
		<pubDate>Sat, 27 Apr 2024 14:41:38 +0000</pubDate>
				<category><![CDATA[Containers]]></category>
		<category><![CDATA[Docker]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<guid isPermaLink="false">https://aprendeit.com/?p=6208</guid>

					<description><![CDATA[<p>Wazuh has become an essential tool for security management in information systems. Thanks to its ability to detect intrusions, ensure data integrity, and monitor security, many companies and individuals choose ...</p>
<p>La entrada <a href="https://aprendeit.com/en/install-your-own-wazuh-server-on-ubuntu/">Install Your Own Wazuh Server on Ubuntu</a> se publicó primero en <a href="https://aprendeit.com/en/aprende-it-2">Aprende IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Wazuh has become an essential tool for security management in information systems. Thanks to its ability to detect intrusions, ensure data integrity, and monitor security, many companies and individuals choose to set up their own Wazuh server. Here I will explain how you can install and configure your Wazuh server, step by step, without using complicated lists or enumerations.</p>
<h2>What is Wazuh and Why Should You Use It?</h2>
<p>Wazuh is an open-source security platform that provides intrusion detection, integrity monitoring, incident response, and compliance auditing. Its versatility makes it ideal for both small businesses and large corporations. Furthermore, being open-source, Wazuh is completely free and allows modifications to meet any specific needs.</p>
<h2>Initial Preparations Before Installation</h2>
<p>Before you dive into the installation of Wazuh, it is crucial that you prepare your system. This involves ensuring that the operating system is updated and setting up the environment to support the installation of Wazuh through Docker. Here is how you do it:</p>
<p>First, it is necessary to disable the firewall to prevent it from interfering with the installation process. To do this, simply execute in the terminal:</p>
<pre>ufw disable</pre>
<p>This command will disable the firewall, ensuring that it will not block any of the necessary connections during the installation.</p>
<p>Next, you must ensure that all system packages are updated and that git is installed, as you will need it to clone the Wazuh repository. Execute:</p>
<pre>apt update &amp;&amp; apt install git</pre>
<p>With these commands, your system will be updated and ready for the next phase.</p>
<h2>Installing Docker</h2>
<p>Wazuh in Docker simplifies dependency management and ensures that the platform can run isolated and secure. To install Docker, you can use the script provided by Docker, which sets up everything automatically:</p>
<pre>curl -sSL https://get.docker.com/ | sh</pre>
<p>Once Docker is installed, it is essential to ensure it automatically runs at system startup:</p>
<pre>systemctl start docker
systemctl enable docker</pre>
<p>These commands will start the Docker service and configure it to automatically start at each system boot.</p>
<h2>Docker Compose</h2>
<p>If you install Docker as previously indicated, you do not need to install this tool, but if you already have Docker and it does not support &#8220;docker compose&#8221;, you can install docker-compose like this:</p>
<pre>curl -L "https://github.com/docker/compose/releases/download/v2.12.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose</pre>
<p>The following commands that have &#8220;docker compose&#8221; should be executed as docker-compose.</p>
<p>&nbsp;</p>
<h2>Setting Up the Wazuh Environment</h2>
<p>With Docker already configured, the next step is to prepare the specific environment for Wazuh. Head to the optimal directory to keep organized the files related to security:</p>
<pre>cd /opt</pre>
<p>Now, it is time to clone the most recent version of the Wazuh repository for Docker:</p>
<pre>git clone https://github.com/wazuh/wazuh-docker.git -b v4.7.3</pre>
<p>This command downloads all the necessary files to run Wazuh in a Docker container.</p>
<h2>Generating Certificates and Starting Up Wazuh</h2>
<p>Before starting Wazuh, you must generate the necessary certificates for the proper functioning of the Wazuh components. Navigate to the correct directory and execute the certificate generator:</p>
<pre>cd wazuh-docker/single-node/
docker compose -f generate-indexer-certs.yml run --rm generator</pre>
<p>With the certificates generated, you are now ready to start all the Wazuh services:</p>
<pre>docker compose up -d</pre>
<p>This last command lifts all the containers necessary for Wazuh to operate properly in a single-node mode, ideal for test environments or small implementations.</p>
<h2>Verification of the Installation</h2>
<p>Once all the previous steps are completed, it is important to verify that everything is working as expected. You can check the status of the Docker containers to ensure that all Wazuh services are active and running. Additionally, access the Wazuh web interface to start exploring the functionalities and available settings.</p>
<h2>Customization and Monitoring</h2>
<p>With your Wazuh server now operational, the next step is to customize the configuration to adapt it to your specific needs. Wazuh offers a wide variety of options for configuring rules, alerts, and automatic responses to incidents. Take advantage of the available documentation to explore all the possibilities that Wazuh offers.</p>
<p>Installing and configuring your own Wazuh server may seem like a complex task, but by following these steps, you will have a robust computer security system without needing large investments. Not only will it improve the security of your information, but it will also provide you with a powerful tool to monitor and proactively respond to any incident.</p>
<h2>Wazuh Password Change</h2>
<p>Stop the service using Docker Compose:</p>
<pre>docker compose down
</pre>
<h3>Generate the hash of the new password using the Wazuh container:</h3>
<p>Run the following command to start the hash script:</p>
<pre>docker run --rm -ti wazuh/wazuh-indexer:4.6.0 bash /usr/share/wazuh-indexer/plugins/opensearch-security/tools/hash.sh</pre>
<p>Enter the new password when prompted and copy the generated hash.</p>
<h3>Update the internal users file with the hash of the new password:</h3>
<p>Open the file with a text editor like vim:</p>
<pre>vim config/wazuh_indexer/internal_users.yml</pre>
<p>Paste the generated hash for the admin user.</p>
<h3>Update the docker-compose.yml file with the new password:</h3>
<p>Open the docker-compose.yml file:</p>
<pre>vim docker-compose.yml</pre>
<p>Enter the new password in lines 24 and 81 where it says INDEXER_PASSWORD.</p>
<h3>Raise the services again with Docker Compose:</h3>
<pre>docker compose up -d</pre>
<p>This restarts the service stack.</p>
<h3>Access the container and run the security script:</h3>
<p>Access the container:</p>
<pre>docker exec -it single-node-wazuh.indexer-1 bash</pre>
<p>Define the variables and run the security script:</p>
<pre>export INSTALLATION_DIR=/usr/share/wazuh-indexer
CACERT=$INSTALLATION_DIR/certs/root-ca.pem
KEY=$INSTALLATION_DIR/certs/admin-key.pem
CERT=$INSTALLATION_DIR/certs/admin.pem
export JAVA_HOME=/usr/share/wazuh-indexer/jdk
bash /usr/share/wazuh-indexer/plugins/opensearch-security/tools/securityadmin.sh -cd /usr/share/wazuh-indexer/opensearch-security/ -nhnv -cacert $CACERT -cert $CERT -key $KEY -p 9200 -icl
</pre>
<p>Exit the container:</p>
<pre>exit</pre>
<p>This process allows you to update the admin password for Wazuh using Docker, making sure to follow all the steps correctly to ensure the changes are effective.</p>
<p>La entrada <a href="https://aprendeit.com/en/install-your-own-wazuh-server-on-ubuntu/">Install Your Own Wazuh Server on Ubuntu</a> se publicó primero en <a href="https://aprendeit.com/en/aprende-it-2">Aprende IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://aprendeit.com/en/install-your-own-wazuh-server-on-ubuntu/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Docker Container Security: Best Practices and Recommendations</title>
		<link>https://aprendeit.com/en/docker-container-security-best-practices-and-recommendations/</link>
					<comments>https://aprendeit.com/en/docker-container-security-best-practices-and-recommendations/#respond</comments>
		
		<dc:creator><![CDATA[Gerardo G. Urtiaga]]></dc:creator>
		<pubDate>Fri, 11 Aug 2023 17:51:49 +0000</pubDate>
				<category><![CDATA[Containers]]></category>
		<category><![CDATA[Docker]]></category>
		<guid isPermaLink="false">https://aprendeit.com/?p=5413</guid>

					<description><![CDATA[<p>Hey there, tech enthusiast! If you&#8217;re here, it&#8217;s probably because you&#8217;ve heard a lot about Docker and how crucial it is to keep our containers secure. But do you know ...</p>
<p>La entrada <a href="https://aprendeit.com/en/docker-container-security-best-practices-and-recommendations/">Docker Container Security: Best Practices and Recommendations</a> se publicó primero en <a href="https://aprendeit.com/en/aprende-it-2">Aprende IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Hey there, tech enthusiast! If you&#8217;re here, it&#8217;s probably because you&#8217;ve heard a lot about Docker and how crucial it is to keep our containers secure. But do you know how to do that? If the answer is no, you&#8217;re in the right spot. Today, I&#8217;ll guide you through discovering the best practices and recommendations for Docker container security. Let&#8217;s dive in!</p>
<p>Understanding the Importance of Docker Security<br />
Before diving into the world of Docker and its security, it&#8217;s essential to grasp why it&#8217;s so critical. Docker has revolutionized the way we deploy applications, making the process more streamlined and efficient. However, like any technology, it&#8217;s not without its vulnerabilities. A poorly configured Docker container can be a gateway for cybercriminals. And as we all know, it&#8217;s better to be safe than sorry.</p>
<p>The Principle of Least Privilege<br />
First off, let&#8217;s talk about the principle of least privilege. It&#8217;s a golden rule in IT security. The idea is to grant programs and processes only the privileges they genuinely need to get their job done. Nothing more.</p>
<p>In the Docker context, this means you should avoid running containers with root privileges unless absolutely necessary. If an attacker manages to access a container with root privileges, they could potentially take control over the entire host system. So, whenever possible, limit those privileges.</p>
<p>Trusted Images<br />
Now, let&#8217;s focus on images. They&#8217;re the foundation of our containers. But where do you get them from? Not all images available on Docker Hub are safe. Some might have known vulnerabilities or even hidden malware.</p>
<p>I recommend only using images from trustworthy sources. If possible, opt for official images or those from well-known providers. And if you decide to build your own images, ensure they&#8217;re up to date and follow good security practices in their design.</p>
<p>Vulnerability Scanning<br />
Let&#8217;s talk tools! Nowadays, there are specific solutions designed to scan Docker containers for vulnerabilities. These tools can identify issues in images before they&#8217;re deployed. It&#8217;s a proactive approach to tackle risks.</p>
<p>I advise integrating these scans into your continuous integration and delivery process. This way, every time a new version of your application is prepared, you can be sure the containers are clean and ready for action.</p>
<p>Networking and Communications<br />
Another critical aspect is networking. Docker allows you to create virtual networks for your containers to communicate with each other. However, not all containers should talk to one another. In fact, in many cases, it&#8217;s preferable they&#8217;re isolated.</p>
<p>By familiarizing yourself with Docker networks, you can configure them so only specific containers have access to others. This reduces the attack surface and limits the potential lateral movement of any intruders.</p>
<p>Regular Updates<br />
One thing that should never be missing from your security routine is updates. Keeping Docker, your containers, and the applications running in them updated is vital. Updates don&#8217;t only introduce new features but also patch vulnerabilities.</p>
<p>So, always stay tuned to Docker news and updates. If a critical vulnerability emerges, you&#8217;ll want to be among the first to address it.</p>
<p>Limit Access<br />
Last but not least, limit access to your containers. Not everyone in your organization needs to access all Docker functions. Define roles and permissions and grant them wisely. And, of course, ensure any access is backed by robust authentication and, if possible, multi-factor.</p>
<p>So, what did you think of this journey through Docker security? I hope you found it beneficial and will implement these recommendations. Cybersecurity is an ongoing task, requiring our attention and care. But with the right tools and best practices, you can rest easy knowing your Docker containers are well-protected. Catch you next time!</p>
<p>La entrada <a href="https://aprendeit.com/en/docker-container-security-best-practices-and-recommendations/">Docker Container Security: Best Practices and Recommendations</a> se publicó primero en <a href="https://aprendeit.com/en/aprende-it-2">Aprende IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://aprendeit.com/en/docker-container-security-best-practices-and-recommendations/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Docker Container Performance Optimization: Practical Tips for Best Performance</title>
		<link>https://aprendeit.com/en/docker-container-performance-optimization-practical-tips-for-best-performance/</link>
					<comments>https://aprendeit.com/en/docker-container-performance-optimization-practical-tips-for-best-performance/#respond</comments>
		
		<dc:creator><![CDATA[Gerardo G. Urtiaga]]></dc:creator>
		<pubDate>Mon, 24 Jul 2023 04:52:17 +0000</pubDate>
				<category><![CDATA[Containers]]></category>
		<category><![CDATA[Docker]]></category>
		<guid isPermaLink="false">https://aprendeit.com/?p=5329</guid>

					<description><![CDATA[<p>Hello, and welcome to a new post! Today, we&#8217;re diving into a crucial topic for any developer using Docker: how to optimize Docker container performance. You might have landed here ...</p>
<p>La entrada <a href="https://aprendeit.com/en/docker-container-performance-optimization-practical-tips-for-best-performance/">Docker Container Performance Optimization: Practical Tips for Best Performance</a> se publicó primero en <a href="https://aprendeit.com/en/aprende-it-2">Aprende IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Hello, and welcome to a new post! Today, we&#8217;re diving into a crucial topic for any developer using Docker: how to optimize Docker container performance. You might have landed here wondering, &#8220;How can I make my Docker containers run as efficiently as possible?&#8221; Well, you&#8217;re in the right place!</p>
<h2>Why do you need to optimize Docker containers?</h2>
<p>First, it&#8217;s important to understand why you need to optimize your Docker containers. Docker is a fantastic tool that allows developers to package and distribute their applications in containers really effectively. However, like any other technology, it&#8217;s not perfect and might require some optimization to ensure your application runs as well as possible.</p>
<p>Imagine you&#8217;re driving a car. If you don&#8217;t change the oil regularly or check the brakes, your car is likely not going to perform at its best. The same goes for Docker. If you don&#8217;t make an effort to optimize your containers, you can end up with suboptimal performance.</p>
<h2>How to know if your Docker containers need optimization?</h2>
<p>Well, the million-dollar question, how do you know if your Docker containers need optimization? Several signs might indicate that you need to work on optimizing your Docker containers.</p>
<p>If you observe that your applications take too long to load, or if your containers use an excessive amount of CPU or memory, it&#8217;s likely you need to make some adjustments. Another indicator could be if you see your containers crash frequently, or if you notice that your applications are unable to handle the amount of traffic you expected.</p>
<h2>Understanding Docker and Resource Optimization</h2>
<p>To be able to optimize the performance of your Docker containers, you first need to understand how Docker uses system resources. Docker runs on a host machine and uses the resources of that machine to run containers. However, Docker doesn&#8217;t use all the resources of the host machine by default. Instead, it limits the amount of resources each container can use.</p>
<p>Now, with a better understanding of how Docker uses system resources, we can explore how to optimize the performance of your Docker containers.</p>
<h2>Reducing Docker Image Size</h2>
<p>One effective way to improve the performance of your Docker containers is by reducing the size of your Docker images. Large images can slow down the startup of your containers and increase memory usage. Therefore, by reducing the size of your Docker images, you can help improve the speed and efficiency of your containers.</p>
<p>There are several ways to do this. One is by using smaller base images. For instance, instead of using a Ubuntu base image, you could use an Alpine base image, which is significantly smaller. Another strategy is to remove any unnecessary files from your images. This includes temporary files, cache files, and packages that aren&#8217;t necessary for running your application.</p>
<h2>Limiting Resource Usage</h2>
<p>Another strategy to optimize your Docker containers is to limit resource usage. As mentioned before, Docker limits the amount of resources each container can use. However, you can adjust these limits to ensure that your containers aren&#8217;t using more resources than they need.</p>
<p>For example, you can limit the amount of CPU a container can use by setting a CPU limit in your Docker configuration file. Similarly, you can limit the amount of memory a container can use by setting a memory limit.</p>
<h2>Efficiently Using Storage in Docker</h2>
<p>Storage is another crucial resource that Docker uses, and it can affect the performance of your containers. Therefore, it&#8217;s vital that you use Docker&#8217;s storage as efficiently as possible.</p>
<p>One tip to do this is to limit the amount of data your containers are writing to disk. The more data a container writes to disk, the slower it will be. Therefore, if you can reduce the amount of disk writes, you can improve your containers&#8217; performance.</p>
<p>Additionally, keep in mind that Docker uses a storage layer to manage container data. Each time a container writes data to disk, Docker creates a new storage layer. This can slow down your containers, especially if they&#8217;re writing large amounts of data. Therefore, it&#8217;s recommended that you optimize the use of Docker&#8217;s storage layer.</p>
<h2>Optimizing Networks in Docker</h2>
<p>Last but not least, the network is a crucial resource in Docker that can also affect the performance of your containers. Networking in Docker can be complex as it involves communication between containers, between containers and the host machine, and between containers and the outside world.</p>
<p>One way to optimize networking in Docker is by using custom networks. Docker allows you to create your own networks and assign containers to these networks. This can be helpful for optimizing container-to-container communication, as you can group containers that need to communicate with each other on the same network.</p>
<p>Additionally, you can optimize networking in Docker by adjusting network parameters. Docker allows you to adjust various network parameters, such as buffer size, network congestion, and flow control. By adjusting these parameters, you can help improve Docker&#8217;s network efficiency.</p>
<h2>And that&#8217;s all&#8230;</h2>
<p>I hope these tips have helped you understand how you can optimize the performance of your Docker containers. Remember that each application is unique, and what works for one might not work for another. Therefore, it&#8217;s important to experiment and find the optimization strategies that work best for your applications.</p>
<p>Until the next post!</p>
<p>La entrada <a href="https://aprendeit.com/en/docker-container-performance-optimization-practical-tips-for-best-performance/">Docker Container Performance Optimization: Practical Tips for Best Performance</a> se publicó primero en <a href="https://aprendeit.com/en/aprende-it-2">Aprende IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://aprendeit.com/en/docker-container-performance-optimization-practical-tips-for-best-performance/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to debug applications in Docker containers: Your ultimate guide</title>
		<link>https://aprendeit.com/en/how-to-debug-applications-in-docker-containers-your-ultimate-guide/</link>
					<comments>https://aprendeit.com/en/how-to-debug-applications-in-docker-containers-your-ultimate-guide/#respond</comments>
		
		<dc:creator><![CDATA[Gerardo G. Urtiaga]]></dc:creator>
		<pubDate>Thu, 13 Jul 2023 12:44:46 +0000</pubDate>
				<category><![CDATA[Containers]]></category>
		<category><![CDATA[Development / programming]]></category>
		<category><![CDATA[Docker]]></category>
		<category><![CDATA[Kubernetes]]></category>
		<guid isPermaLink="false">https://aprendeit.com/?p=5294</guid>

					<description><![CDATA[<p>Hey there, fearless developer! If you&#8217;re here, it&#8217;s because you&#8217;re looking for how to debug your applications in Docker containers. We understand this process can seem complex, but don&#8217;t worry! ...</p>
<p>La entrada <a href="https://aprendeit.com/en/how-to-debug-applications-in-docker-containers-your-ultimate-guide/">How to debug applications in Docker containers: Your ultimate guide</a> se publicó primero en <a href="https://aprendeit.com/en/aprende-it-2">Aprende IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Hey there, fearless developer! If you&#8217;re here, it&#8217;s because you&#8217;re looking for how to debug your applications in Docker containers. We understand this process can seem complex, but don&#8217;t worry! You&#8217;re in the right place. Throughout this post, you will learn the tricks and techniques to deploy and debug your applications efficiently.</p>
<h2>Understanding Docker and containers</h2>
<p>Before diving into the intricacies of debugging, it&#8217;s good to briefly clarify what Docker is and why containers are so relevant in modern application development. Docker is a tool that allows developers like you to package applications and their dependencies into containers. These containers are lightweight and portable, allowing you to run your applications on any operating system that supports Docker, without worrying about tedious configuration tasks.</p>
<h2>Tools for debugging in Docker</h2>
<h3>Debugging from the host</h3>
<p>First, let&#8217;s talk about how you can debug your applications from the same host where the Docker container is running. This is useful in situations where you want to track what&#8217;s happening in your application in real-time without needing to access the container.</p>
<p>You can use tools like <code>docker logs</code>, which allows you to view your applications&#8217; logs in real-time. Plus, you can use <code>docker top</code> to view the processes that are running inside your container. This allows you to see what&#8217;s consuming resources and if there&#8217;s any process that shouldn&#8217;t be running.</p>
<h3>Accessing the container</h3>
<p>Occasionally, you will need to directly access the container to debug your application. Docker allows you to do this using the <code>docker exec</code> command, which lets you run commands inside your container as if you were on the host operating system.</p>
<p>Once inside the container, you can use the debugging tools installed on your image. For example, if you&#8217;re working with a Python application, you could use pdb to debug your code.</p>
<h3>Debugging with Docker Compose</h3>
<p>Docker Compose is another tool that will be useful in debugging your applications. Docker Compose allows you to define and run multi-container applications with a simple description in a YAML file.</p>
<p>Like with Docker, you can access your applications&#8217; logs with <code>docker-compose logs</code>, and you can also access the container with <code>docker-compose exec</code>.</p>
<h2>Techniques for debugging applications in Docker</h2>
<h3>Runtime debugging</h3>
<p>Runtime debugging allows you to inspect your application&#8217;s state while it&#8217;s running. You can do this using tools like pdb (for Python) or gdb (for C/C++) within your container.</p>
<p>These tools allow you to put breakpoints in your code, inspect variables, and step through your application&#8217;s execution, allowing you to see exactly what&#8217;s happening at each moment.</p>
<h3>Post-mortem debugging</h3>
<p>Post-mortem debugging is done after your application has crashed. This allows you to inspect your application&#8217;s state at the moment of failure.</p>
<p>Post-mortem debugging is especially useful when you encounter intermittent or hard-to-reproduce errors. In these cases, you can set up your application to generate a memory dump in case of failure, which you can later analyze to find the problem.</p>
<h3>Tracing and Profiling</h3>
<p>Another useful technique in debugging applications in Docker is tracing and profiling. This gives you detailed information about your application&#8217;s execution, such as how long each function takes to execute or memory usage.</p>
<p>There are various tools that allow you to trace and profile your applications in Docker, like strace (for Linux-based systems) or DTrace (for Unix-based systems).</p>
<h2>Final tips</h2>
<p>Before wrapping up, I&#8217;d like to give you some tips to make your experience debugging applications in Docker as bearable as possible:</p>
<ul>
<li>Make sure you have a good understanding of how Docker works. The better you understand Docker, the easier it will be to debug your applications.</li>
<li>Familiarize yourself with the debugging tools available for your programming language.</li>
<li>Don&#8217;t forget the importance of good logs. A good logging system can be your best ally when debugging problems in your applications.</li>
<li>Use Docker Compose to orchestrate your multi-container applications. This will make it easier to debug problems that arise from the interaction between various containers.</li>
</ul>
<p>In summary, debugging applications in Docker containers can be a complex task, but with the right tools and techniques, you&#8217;ll be able to do it efficiently and effectively. Remember, practice makes perfect, so don&#8217;t get frustrated if it seems complicated at first. Cheer up and let&#8217;s get debugging!</p>
<p>La entrada <a href="https://aprendeit.com/en/how-to-debug-applications-in-docker-containers-your-ultimate-guide/">How to debug applications in Docker containers: Your ultimate guide</a> se publicó primero en <a href="https://aprendeit.com/en/aprende-it-2">Aprende IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://aprendeit.com/en/how-to-debug-applications-in-docker-containers-your-ultimate-guide/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Migrating from Docker Swarm to Kubernetes: A Case Study</title>
		<link>https://aprendeit.com/en/migrating-from-docker-swarm-to-kubernetes-a-case-study/</link>
					<comments>https://aprendeit.com/en/migrating-from-docker-swarm-to-kubernetes-a-case-study/#respond</comments>
		
		<dc:creator><![CDATA[Gerardo G. Urtiaga]]></dc:creator>
		<pubDate>Mon, 19 Jun 2023 11:21:42 +0000</pubDate>
				<category><![CDATA[Docker]]></category>
		<category><![CDATA[Kubernetes]]></category>
		<guid isPermaLink="false">https://aprendeit.com/?p=5190</guid>

					<description><![CDATA[<p>Hello everyone! Today, I&#8217;m going to share an exciting story with you &#8211; how we decided to migrate from Docker Swarm to Kubernetes. You might be wondering: why make this ...</p>
<p>La entrada <a href="https://aprendeit.com/en/migrating-from-docker-swarm-to-kubernetes-a-case-study/">Migrating from Docker Swarm to Kubernetes: A Case Study</a> se publicó primero en <a href="https://aprendeit.com/en/aprende-it-2">Aprende IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="group w-full text-gray-800 dark:text-gray-100 border-b border-black/10 dark:border-gray-900/50 bg-gray-50 dark:bg-[#444654]">
<div class="flex p-4 gap-4 text-base md:gap-6 md:max-w-2xl lg:max-w-[38rem] xl:max-w-3xl md:py-6 lg:px-0 m-auto">
<div class="relative flex w-[calc(100%-50px)] flex-col gap-1 md:gap-3 lg:w-[calc(100%-115px)]">
<div class="flex flex-grow flex-col gap-3">
<div class="min-h-[20px] flex flex-col items-start gap-4 whitespace-pre-wrap break-words">
<div class="markdown prose w-full break-words dark:prose-invert light">
<p>Hello everyone! Today, I&#8217;m going to share an exciting story with you &#8211; how we decided to migrate from Docker Swarm to Kubernetes. You might be wondering: why make this change? Well, there are various reasons, and all of them add up to make Kubernetes a very appealing option. Let&#8217;s get into it!</p>
<h2>Why the Change: Kubernetes Advantages over Docker Swarm</h2>
<p>Docker Swarm is great, don&#8217;t get me wrong. It&#8217;s easy to use, has a gentle learning curve, and deployments are quick. However, if you&#8217;re looking for a tool with greater scalability, robustness, and flexibility, Kubernetes is your guy.</p>
<p>On the one hand, Kubernetes takes the trophy when it comes to scalability. Its ability to handle a large number of containers in a cluster is something that Kubernetes excels at. And if you add the possibility of managing several clusters at once, we have an indisputable winner.</p>
<p>Moreover, Kubernetes boasts a rich and diverse ecosystem. It offers a wide range of plugins and extensions, greatly increasing its flexibility. On top of that, the community that backs it is very active, with constant updates and improvements. In contrast, the Docker Swarm community, although dedicated, can&#8217;t compete in terms of size and activity.</p>
<h2>Our Scenario: Where We Started</h2>
<p>We were in a situation where we had already implemented Docker Swarm in our infrastructure. We had several services running on Swarm, which worked well and served their purpose. But we knew we could improve our architecture.</p>
<h2>The Path to Kubernetes: First Steps</h2>
<p>The first step to migrating from Docker Swarm to Kubernetes is creating a Kubernetes cluster. In our case, we chose to use Google Kubernetes Engine (GKE) for its ease of use and powerful functionalities. However, there are other options, like AWS EKS or Azure AKS, that you might also consider.</p>
<p>Once we created our cluster, we set to work on converting our Docker Compose Files to Kubernetes. This is where Helm comes in. Helm is a package manager for Kubernetes that allows us to define, install, and upgrade applications easily.</p>
<h2>From Swarm to Cluster: Conversions and Configurations</h2>
<p>Converting Docker Compose files to Helm files isn&#8217;t tricky, but it does require attention to detail. Luckily, there are tools like Kompose that make our lives easier. Kompose automatically converts Docker Compose files into Kubernetes files.</p>
<p>Once we converted our files, it was time to define our configurations. Kubernetes&#8217; ConfigMaps and Secrets are the equivalent to environment variables in Docker Swarm. Here, we needed to make some modifications, but in general, the process was quite straightforward.</p>
<h2>Deploying on Kubernetes: Challenges Faced</h2>
<p>Now, with our Kubernetes cluster ready and our Helm files prepared, it was time to deploy our services. This is where we encountered some challenges.</p>
<p>The first challenge was managing network traffic. Unlike Docker Swarm, which uses an overlay network to connect all nodes, Kubernetes uses a different approach called CNI (Container Network Interface). This required a change in our network configuration.</p>
<p>Additionally, we had to adjust our firewall rules to allow traffic between the different Kubernetes services. Fortunately, Kubernetes&#8217; Network Policies made this task easier.</p>
<p>The next challenge was managing volumes. While Docker Swarm uses volumes for persistent storage, Kubernetes uses Persistent Volumes and Persistent Volume Claims. While the concept is similar, the implementation differs somewhat.</p>
<p>In our case, we used Docker volumes to store data from our databases. When migrating to Kubernetes, we had to convert these volumes into Persistent Volumes, which required some additional work.</p>
<p>Finally, we faced the challenge of monitoring our new Kubernetes cluster. Although there are many tools for monitoring Kubernetes, choosing the right one can be complicated.</p>
<p>In our case, we opted for Prometheus and Grafana. Prometheus provides us with a powerful monitoring and alerting solution, while Grafana allows us to visualize the data in an attractive way.</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="group w-full text-gray-800 dark:text-gray-100 border-b border-black/10 dark:border-gray-900/50 bg-gray-50 dark:bg-[#444654]">
<div class="flex p-4 gap-4 text-base md:gap-6 md:max-w-2xl lg:max-w-[38rem] xl:max-w-3xl md:py-6 lg:px-0 m-auto">
<div class="relative flex w-[calc(100%-50px)] flex-col gap-1 md:gap-3 lg:w-[calc(100%-115px)]">
<div class="flex flex-grow flex-col gap-3">
<div class="min-h-[20px] flex flex-col items-start gap-4 whitespace-pre-wrap break-words">
<div class="markdown prose w-full break-words dark:prose-invert light">
<h2>Surprises Along the Way: What We Didn&#8217;t Expect</h2>
<p>As with any project, we ran into a few surprises along the way. Some of them were pleasant, others not so much.</p>
<p>On one hand, we were pleasantly surprised by how easily we could scale our services on Kubernetes. Thanks to the auto-scaling function, we were able to automatically adjust the number of pods based on workload. This allowed us to improve the performance of our services and save resources.</p>
<p>On the other hand, we encountered some issues with updates. Unlike Docker Swarm, where updates are quite straightforward, in Kubernetes we had to grapple with Rolling Updates. Although they are a powerful feature, they require some practice to master.</p>
<h2>Mission Accomplished!: Kubernetes Up and Running</h2>
<p>Finally, after overcoming challenges and learning from surprises, we successfully migrated from Docker Swarm to Kubernetes. Now, our services run more efficiently, and we have greater flexibility and control over our infrastructure.</p>
<p>I&#8217;m sure that we still have a lot to learn about Kubernetes. But, without a doubt, this first step has been worth it. The migration has allowed us to improve our architecture, optimize our services, and prepare for future challenges.</p>
<p>And you, have you considered migrating from Docker Swarm to Kubernetes? What do you think of our experience? We&#8217;re eager to hear your impressions and learn from your experiences!</p>
</div>
</div>
</div>
</div>
</div>
</div>
<p>La entrada <a href="https://aprendeit.com/en/migrating-from-docker-swarm-to-kubernetes-a-case-study/">Migrating from Docker Swarm to Kubernetes: A Case Study</a> se publicó primero en <a href="https://aprendeit.com/en/aprende-it-2">Aprende IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://aprendeit.com/en/migrating-from-docker-swarm-to-kubernetes-a-case-study/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>10 Essential Docker Tricks You Should Know</title>
		<link>https://aprendeit.com/en/10-essential-docker-tricks-you-should-know/</link>
					<comments>https://aprendeit.com/en/10-essential-docker-tricks-you-should-know/#respond</comments>
		
		<dc:creator><![CDATA[Gerardo G. Urtiaga]]></dc:creator>
		<pubDate>Tue, 13 Jun 2023 17:31:44 +0000</pubDate>
				<category><![CDATA[Docker]]></category>
		<guid isPermaLink="false">https://aprendeit.com/?p=5213</guid>

					<description><![CDATA[<p>Before diving into Docker&#8217;s tricks, it&#8217;s vital to understand what Docker is and why it has become such a critical tool in the world of development and system administration. Docker ...</p>
<p>La entrada <a href="https://aprendeit.com/en/10-essential-docker-tricks-you-should-know/">10 Essential Docker Tricks You Should Know</a> se publicó primero en <a href="https://aprendeit.com/en/aprende-it-2">Aprende IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="group w-full text-gray-800 dark:text-gray-100 border-b border-black/10 dark:border-gray-900/50 bg-gray-50 dark:bg-[#444654]">
<div class="flex p-4 gap-4 text-base md:gap-6 md:max-w-2xl lg:max-w-[38rem] xl:max-w-3xl md:py-6 lg:px-0 m-auto">
<div class="relative flex w-[calc(100%-50px)] flex-col gap-1 md:gap-3 lg:w-[calc(100%-115px)]">
<div class="flex flex-grow flex-col gap-3">
<div class="min-h-[20px] flex flex-col items-start gap-4 whitespace-pre-wrap break-words">
<div class="markdown prose w-full break-words dark:prose-invert light">
<p>Before diving into Docker&#8217;s tricks, it&#8217;s vital to understand what Docker is and why it has become such a critical tool in the world of development and system administration. Docker is a container platform that allows developers and system administrators to efficiently and securely package, distribute, and manage applications. At the heart of Docker are containers, isolated environments where applications run, bypassing the issues of &#8220;it works on my machine&#8221;.</p>
<p>But now let&#8217;s get to what really matters, those Docker tricks that will make your life much easier.</p>
<h2>Leveraging the Dockerfile</h2>
<p>The Dockerfile is the document that defines how your Docker image, which will give life to your container, is built. You can see it as a recipe, where each line is an instruction to add ingredients (layers) to your image.</p>
<p><strong>Don&#8217;t forget about .dockerignore</strong>: Just like with git, Docker has a system to ignore files. Any file or folder specified in .dockerignore will not be copied into the Docker image. This is useful for ignoring unnecessary files, like logs, node_modules files, or any others not needed to run your application.</p>
<p><strong>Use of cache layers</strong>: Docker caches the image layers every time you build one. If you haven&#8217;t made changes to that specific layer, Docker will reuse it, speeding up the building process. If you place the instructions that change the least at the beginning of the Dockerfile, you&#8217;ll be able to take full advantage of this feature.</p>
<h2>Playing with Containers</h2>
<p>Containers are the essence of Docker, but they can also be tricky to handle if you don&#8217;t know some tricks.</p>
<p><strong>Efficient container management</strong>: Docker offers several commands to manage containers. For example, you can use <code>docker ps -a</code> to see all your containers (even the ones that are stopped), <code>docker stop $(docker ps -aq)</code> to stop all running containers, and <code>docker rm $(docker ps -aq)</code> to remove all containers.</p>
<p><strong>Docker logs for debugging</strong>: If something goes wrong with your application, you can check your container logs with <code>docker logs CONTAINER_ID</code>. You can even follow the logs in real-time with <code>docker logs -f CONTAINER_ID</code>.</p>
<h2>Docker Images: Less is More</h2>
<p>Docker images can be huge if not handled correctly. Here are a few tricks to keep them as light as possible.</p>
<p><strong>Use minimalist base images</strong>: There are many Docker base images available, but not all are created equal. Some are very heavy and contain a lot of things you probably don&#8217;t need. Try using minimalist base images like Alpine, which only have the essentials.</p>
<p><strong>Remove cache after installations</strong>: When you install something with apt, yum, or any other package manager, it generates a cache that is not necessary to run your application. You can delete it on the same line where you install the package, so you don&#8217;t generate a new layer: for instance, you can use <code>RUN apt-get update &amp;&amp; apt-get install -y my-package &amp;&amp; rm -rf /var/lib/apt/lists/*</code>.</p>
<h2>Orchestrating Containers with Docker Compose</h2>
<p>Docker Compose is an incredible tool that allows you to define and manage multiple containers at once. And, of course, it also has its own tricks.</p>
<p><strong>Use environment variables</strong>: Docker Compose lets you define environment variables in a <code>.env</code> file, which you can then use in your <code>docker-compose.yml</code> file. This is very handy to avoid writing the same things over and over again.</p>
<p><strong>Dependencies between containers</strong>: With Docker Compose, you can define dependencies between containers using the <code>depends_on</code> option. This ensures that Docker Compose starts the containers in the correct order.</p>
<h2>Creating Networks with Docker</h2>
<p>Docker allows you to create networks to connect your containers so that they can communicate with each other.</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="group w-full text-gray-800 dark:text-gray-100 border-b border-black/10 dark:border-gray-900/50 bg-gray-50 dark:bg-[#444654]">
<div class="flex p-4 gap-4 text-base md:gap-6 md:max-w-2xl lg:max-w-[38rem] xl:max-w-3xl md:py-6 lg:px-0 m-auto">
<div class="relative flex w-[calc(100%-50px)] flex-col gap-1 md:gap-3 lg:w-[calc(100%-115px)]">
<div class="flex flex-grow flex-col gap-3">
<div class="min-h-[20px] flex flex-col items-start gap-4 whitespace-pre-wrap break-words">
<div class="markdown prose w-full break-words dark:prose-invert light">
<p><strong>Creating and managing networks</strong>: You can create a network with the <code>docker network create</code> command. Once the network is created, you can connect a container to it with <code>docker network connect</code>.</p>
<p><strong>Inspecting networks</strong>: If you want to see what containers are connected to a network, you can use <code>docker network inspect</code>.</p>
<h2>Optimizing Docker Use</h2>
<p>Finally, there are some general tricks that will help you make the most of Docker.</p>
<p><strong>Docker system prune</strong>: Over time, you are likely to accumulate a bunch of images, containers, and networks that you no longer use. You can remove them all with <code>docker system prune</code>.</p>
<p><strong>Using Docker with CI/CD</strong>: Docker fits perfectly into any continuous integration and continuous deployment process. You can build your Docker image as part of your CI/CD pipeline, test it, and then deploy it to production.</p>
<h2><strong>Using Multi-Stage Builds for Efficient Images</strong></h2>
<p>In Docker, you can use multi-stage builds to optimize your images. This involves dividing your Dockerfile into multiple stages, where each can use a different base image. For example, you can have one stage to compile your application and another to run it. This allows you to include only what is necessary in the final image, keeping it as lightweight as possible.</p>
<h2><strong>Configuring Volumes for Data Persistence</strong></h2>
<p>Data stored in containers is ephemeral and is lost when the container is deleted. To maintain persistent data, you can configure volumes in Docker. This allows you to store data outside the container, ensuring it is not lost even if the container is deleted or updated.</p>
<h2><strong>Using Docker Secrets to Manage Sensitive Data</strong></h2>
<p>Managing sensitive data such as passwords and access tokens is crucial. Docker Secrets provides a secure way to store and manage this information. Secrets are encrypted in transit and at rest, providing an additional layer of security for your sensitive data.</p>
<h2><strong>Optimization with Health Checks</strong></h2>
<p>Health checks in Docker allow you to automatically verify the status of your containers. You can define commands or instructions that Docker will periodically execute to ensure that your application is running correctly. This is especially useful for quickly detecting problems and improving the availability and reliability of your services.</p>
<p>I hope these tricks will help you master Docker and make your life a little easier. Remember, Docker is a powerful tool, but it can also be complicated. With these tips and tricks, you&#8217;ll be able to get the most out of Docker and avoid some of the most common issues.</p>
</div>
</div>
</div>
</div>
</div>
</div>
<p>La entrada <a href="https://aprendeit.com/en/10-essential-docker-tricks-you-should-know/">10 Essential Docker Tricks You Should Know</a> se publicó primero en <a href="https://aprendeit.com/en/aprende-it-2">Aprende IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://aprendeit.com/en/10-essential-docker-tricks-you-should-know/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Best practices building images with Dockerfiles</title>
		<link>https://aprendeit.com/en/best-practices-building-images-with-dockerfiles/</link>
					<comments>https://aprendeit.com/en/best-practices-building-images-with-dockerfiles/#respond</comments>
		
		<dc:creator><![CDATA[Gerardo G. Urtiaga]]></dc:creator>
		<pubDate>Sun, 06 Mar 2022 19:09:39 +0000</pubDate>
				<category><![CDATA[Containers]]></category>
		<category><![CDATA[Docker]]></category>
		<category><![CDATA[Linux-basics]]></category>
		<guid isPermaLink="false">https://aprendeit.com/?p=2745</guid>

					<description><![CDATA[<p>Order matters In Dockerfiles the order matters a lot. For example, it is not the same to execute a COPY or ADD instruction to add an executable file and then ...</p>
<p>La entrada <a href="https://aprendeit.com/en/best-practices-building-images-with-dockerfiles/">Best practices building images with Dockerfiles</a> se publicó primero en <a href="https://aprendeit.com/en/aprende-it-2">Aprende IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Order matters</h2>
<p>In Dockerfiles the order matters a lot. For example, it is not the same to execute a COPY or ADD instruction to add an executable file and then execute it than trying to execute it before adding it. This seems obvious but it is one of the main errors that cause a Dockerfile to not work correctly when trying to create an image from it.</p>
<h2>Lighten the image by deleting files</h2>
<p>Whenever you create an image take into account the deletion of temporary files that we will not need when running the application because this way we will save disk space. For example, if to run the application we download a compressed file, unzip its content and this content is the one we will use, we should delete the compressed file to make the image lighter.</p>
<h2>Reduces the number of files</h2>
<p>Avoid installing unneeded packages. If you do not do this you may have a higher memory and disk consumption with the image you are creating and you may also generate more security problems since you will have to maintain and update these files in each version.</p>
<h2>Avoid including files that you should not by using &#8220;.dockerignore&#8221;.</h2>
<p>Avoid including files that should not be included such as files containing personal data by using &#8220;.dockerignore&#8221; files. These files are similar to &#8220;.gitignore&#8221; files and with a few lines we can avoid filtering information.</p>
<h2>Specifies the base image version and dependencies.</h2>
<p>It is important to use concrete versions and not to use base images and dependencies without specifying version. Not specifying versions can lead to bugs that are not contemplated and difficult to locate.</p>
<h2>Use the correct base image</h2>
<p>It is important to use base images as small as possible as Alpine or Busybox whenever possible. On the other hand it is possible that with some applications we need specific images to make the application work, in this case there is not much more to comment, use it.</p>
<p>Finally whenever possible use official base images, doing this you will avoid problems such as using images with embedded malware.</p>
<h2>Reuse images</h2>
<p>If all the images running on your hosts are based on Ubuntu:20.04 for example, using this base image can save you more disk space than using a small image like Alpine or Busybox since you already have the other image saved on disk.</p>
<p>La entrada <a href="https://aprendeit.com/en/best-practices-building-images-with-dockerfiles/">Best practices building images with Dockerfiles</a> se publicó primero en <a href="https://aprendeit.com/en/aprende-it-2">Aprende IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://aprendeit.com/en/best-practices-building-images-with-dockerfiles/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Why we should containerize our applications</title>
		<link>https://aprendeit.com/en/why-we-should-containerize-our-applications/</link>
					<comments>https://aprendeit.com/en/why-we-should-containerize-our-applications/#respond</comments>
		
		<dc:creator><![CDATA[Gerardo G. Urtiaga]]></dc:creator>
		<pubDate>Wed, 09 Feb 2022 16:46:13 +0000</pubDate>
				<category><![CDATA[Containers]]></category>
		<category><![CDATA[Docker]]></category>
		<category><![CDATA[Kubernetes]]></category>
		<guid isPermaLink="false">https://aprendeit.com/?p=2697</guid>

					<description><![CDATA[<p>Why should we containerize our applications? First of all, it should be noted that an application can run correctly in a system without containers or inside a container. It can ...</p>
<p>La entrada <a href="https://aprendeit.com/en/why-we-should-containerize-our-applications/">Why we should containerize our applications</a> se publicó primero en <a href="https://aprendeit.com/en/aprende-it-2">Aprende IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Why should we containerize our applications? First of all, it should be noted that an application can run correctly in a system without containers or inside a container. It can run correctly in either mode.</p>
<h2><span style="font-weight: 400;">So why &#8220;waste time&#8221; passing the application to containers? </span></h2>
<p>When we prepare an application to run in containers we are not wasting time. On the contrary, we are gaining time in the future.</p>
<p>Let me explain, when an application is prepared to run on containers, we are making the application more independent of a system because we can update the system where the containers run without affecting the application and on the contrary, we can update the application image without affecting the base system. Therefore, we provide a layer of isolation to the application.</p>
<p>It is important to highlight that the image that we prepare for the application should comply with the OCI or Open Container Initiative standards (as can be verified in <a href="https://opencontainers.org/" target="_blank" rel="noopener">https://opencontainers.org/</a> ), that is to say, the image is OCI compliant and we can run the image of our application in all the compatible routines such as:</p>
<p>&nbsp;</p>
<ul>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Docker</span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Containerd</span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Cri-o</span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Rkt</span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Runc</span></li>
</ul>
<h2>Well, what else does it bring us to have the application ready to run in a container?</h2>
<p>We can take advantage of the above mentioned with the previous routines and stand-alone managers such as docker from orchestrators such as:</p>
<ul>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Docker-swarm (it is not the most used) </span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Kubernetes (the orchestrator most used)</span></li>
</ul>
<p>This type of orchestrators provide great advantages for our application, such as high availability, scalability, monitoring, flexibility, etc. They provide an extra abstraction layer that makes it easier to manage networks, volumes, instance management, and everything related to container management.</p>
<p>For example, using Kubernetes you can have an application in production and have it scale based on CPU or RAM usage. You can also make sure that there are a certain number of instances. And most importantly, you can deploy without causing a disaster by very quickly managing a rollback if necessary.</p>
<h2>Conclusions</h2>
<p>Just a few years ago the industry in general only saw this as viable for non-production environments (except for the most daring) but recently we are seeing more and more widespread adoption of this type of technology. In fact, the vast majority of the major cloud technology players have implemented cloud-related services.</p>
<p>La entrada <a href="https://aprendeit.com/en/why-we-should-containerize-our-applications/">Why we should containerize our applications</a> se publicó primero en <a href="https://aprendeit.com/en/aprende-it-2">Aprende IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://aprendeit.com/en/why-we-should-containerize-our-applications/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>The docker system command</title>
		<link>https://aprendeit.com/en/the-docker-system-command/</link>
					<comments>https://aprendeit.com/en/the-docker-system-command/#respond</comments>
		
		<dc:creator><![CDATA[Gerardo G. Urtiaga]]></dc:creator>
		<pubDate>Tue, 18 Jan 2022 18:39:41 +0000</pubDate>
				<category><![CDATA[Curiosities]]></category>
		<category><![CDATA[Development / programming]]></category>
		<category><![CDATA[Docker]]></category>
		<category><![CDATA[Others]]></category>
		<category><![CDATA[Systems]]></category>
		<guid isPermaLink="false">https://aprendeit.com/?p=2433</guid>

					<description><![CDATA[<p>Hello again! This article talks about how to get general information about the whole docker system and do &#8220;cleanup&#8221; of containers, images and volumes with docker system. Docker system The ...</p>
<p>La entrada <a href="https://aprendeit.com/en/the-docker-system-command/">The docker system command</a> se publicó primero en <a href="https://aprendeit.com/en/aprende-it-2">Aprende IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Hello again! This article talks about how to get general information about the whole docker system and do &#8220;cleanup&#8221; of containers, images and volumes with <em>docker system</em>.</p>
<h2>Docker system</h2>
<p>The docker system command has several subcommands:</p>
<p>• docker system info<br />
• docker system df<br />
• docker system events<br />
• docker system prune</p>
<h2>View docker host information</h2>
<p>To see the information about the host from docker we can run the command docker system info or its abbreviation docker info like this:</p>
<pre>[ger-pc ~]# docker info
Client:
Debug Mode: false

Server:
Containers: 1
Running: 1
Paused: 0
Stopped: 0
Images: 5
Server Version: 19.03.7-ce
Storage Driver: overlay2
Backing Filesystem: &lt;unknown&gt;
Supports d_type: true
Native Overlay Diff: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: d76c121f76a5fc8a462dc64594aea72fe18e1178.m
runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
init version: fec3683
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 5.5.8-1-MANJARO
Operating System: Manjaro Linux
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 7.233GiB
Name: ger-pc
ID: MWH3:24AM:UAZJ:E5UL:TRI3:F4NZ:Y3JD:IMKP:7G2V:VV6I:L5XF:J2TW
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false</pre>
<p>This way we will be able to know on which hardware, docker version, system characteristics, we are working on.</p>
<h2>View disk usage of each container</h2>
<p>We can see the disk capacity used by each image, container, volume and build cache. The docker system df command will give us a brief summary of the disk for each docker component as you can see in the following example:</p>
<pre>[ger-pc ~]# docker system df 
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 6 1 1.006GB 803.4MB (79%)
Containers 1 0 2B 2B (100%)
Local Volumes 0 0 0B 0B
Build Cache 0 0 0B 0B
[ger-pc ~]#</pre>
<p>If we also want to know how much disk space each image or each container or each volume occupies, we have to add the -v option to the command as you can see in the following example:</p>
<pre> 
[ger-pc ~]# docker system df -v
Images space usage:

REPOSITORY TAG IMAGE ID CREATED SIZE SHARED SIZE UNIQUE SIZE CONTAINERS
nginx alpine 89ec9da68213 3 days ago 19.94MB 0B 19.94MB 0
archlinux latest 9651b9e35f39 2 weeks ago 412.2MB 0B 412.2MB 0
ubuntu 18.04 4e5021d210f6 5 weeks ago 64.21MB 0B 64.21MB 0
centos 8 470671670cac 3 months ago 237.1MB 0B 237.1MB 0
ubuntu 19.04 c88ac1f841b7 3 months ago 69.99MB 0B 69.99MB 0
centos 7 5e35e350aded 5 months ago 203MB 0B 203MB 1

Containers space usage:

CONTAINER ID IMAGE COMMAND LOCAL VOLUMES SIZE CREATED STATUS NAMES
6e034771f891 centos:7 "/bin/bash" 0 2B 25 hours ago Exited (137) 15 hours ago container1

Local Volumes space usage:

VOLUME NAME LINKS SIZE

Build cache usage: 0B

CACHE ID CACHE TYPE SIZE CREATED LAST USED USAGE SHARED
[ger-pc ~]#
</pre>
<h2>View disk usage of each container</h2>
<p>The docker system events command reports docker system events in real time. This can help us when the system has a failure and we want to prevent it from reoccurring.<br />
The command syntax is very simple:</p>
<pre>docker system events</pre>
<p>&nbsp;</p>
<h2>Remove docker residues</h2>
<p>Docker has a very fast way to clean up the system.<br />
The docker system prune command can help us a lot to perform the system cleanup,</p>
<p>The syntax of the command is:</p>
<pre>docker system prune</pre>
<p>An example of the output is:</p>
<pre>[ger-pc ~]# docker system prune
WARNING! This will remove:
- all stopped containers
- all networks not used by at least one container
- all dangling images
- all dangling build cache

Are you sure you want to continue? [y/N] y
Deleted Containers:
6e034771f891225529dc6fc7eef6f40d537820d7607f68885edc10f2c71c6f9d

Total reclaimed space: 2B
[ger-pc ~]#

</pre>
<p>As you can see it will only eliminate:</p>
<ul>
<li>Stopped containers</li>
<li>Unused nets (no containers)</li>
<li>Images hung</li>
<li>Build cache hung</li>
</ul>
<p>To not ask for confirmation we add the -f parameter so it should be &#8220;docker system prune -f&#8221; and so it will delete all of the above at once, without confirmation,</p>
<p>If we want to delete all the images we can execute the command by adding -a and the command will look like this:</p>
<pre>docker system prune -a</pre>
<p>To remove volumes as well, add the &#8211;volumes parameter as in the following example:</p>
<pre>docker system prune --volumes</pre>
<p>&nbsp;</p>
<h4 style="text-align: center;" align="left"><a href="https://aprendeit.com/producto/docker-para-novatos/">If you are interested in learning Docker you can purchase our book here </a></h4>
<h3 style="text-align: center;"><a href="https://aprendeit.com/producto/docker-para-novatos/">Docker para novatos</a></h3>
<p><a href="https://aprendeit.com/producto/docker-para-novatos/"><img fetchpriority="high" decoding="async" class="wp-image-1834 size-medium aligncenter" src="https://aprendeit.com/wp-content/uploads/2020/05/Docker-para-novatos-Gerardo-G.-Urtiaga-portada-web-2-300x300.jpg" alt="Docker para novatos - Gerardo G. Urtiaga-portada-web" width="300" height="300" srcset="https://aprendeit.com/wp-content/uploads/2020/05/Docker-para-novatos-Gerardo-G.-Urtiaga-portada-web-2-300x300.jpg 300w, https://aprendeit.com/wp-content/uploads/2020/05/Docker-para-novatos-Gerardo-G.-Urtiaga-portada-web-2-150x150.jpg 150w, https://aprendeit.com/wp-content/uploads/2020/05/Docker-para-novatos-Gerardo-G.-Urtiaga-portada-web-2-100x100.jpg 100w, https://aprendeit.com/wp-content/uploads/2020/05/Docker-para-novatos-Gerardo-G.-Urtiaga-portada-web-2.jpg 600w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>If you liked the article, share it on your social networks so we can reach more people!</p>
<p>Best regards</p>
<p>La entrada <a href="https://aprendeit.com/en/the-docker-system-command/">The docker system command</a> se publicó primero en <a href="https://aprendeit.com/en/aprende-it-2">Aprende IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://aprendeit.com/en/the-docker-system-command/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 
Lazy Loading (feed)
Minified using Disk
Database Caching 171/183 queries in 0.026 seconds using Disk

Served from: aprendeit.com @ 2026-04-04 21:45:53 by W3 Total Cache
-->