Your Docker image might be bigger than it needs to be. 🐳 When installing Python dependencies inside a container, 𝘱𝘪𝘱 stores downloaded packages in its cache, which makes perfect sense on a local machine. But inside Docker? Image layers already provide caching. Keeping the 𝘱𝘪𝘱 cache only increases image size without adding value. In production, that means: • Larger images • Slower pulls • Longer deployments • Bigger attack surface Smaller images. Faster deployments. Cleaner builds. Are you disabling pip cache in your Dockerfiles? #Docker #DevOps #Python #ContainerSecurity #CodeQuality #Codeac
Disable pip cache in Docker for smaller images
More Relevant Posts
-
🚀 Just built and containerized my first Flask application with Docker! I created a simple Python Flask API, deployed it in a Docker container, exposed REST endpoints, and ran it locally with port mapping. What I practiced: • Creating a Dockerfile • Building Docker images • Running containers with port mapping • Deploying a Flask API inside Docker This was a great hands-on exercise to understand containerization and application deployment workflows better. 💻 GitHub Repository: https://lnkd.in/dmDcMYQa #Docker #Python #Flask #DevOps #SoftwareEngineering #BackendDevelopment
To view or add a comment, sign in
-
🐳 Python + Docker – Production trips If your Python app runs in Docker, remember 3 things: 1️⃣ Use multi-stage builds – keep build tools out of runtime. 2️⃣ Don’t run as root – least privilege always. 3️⃣ Keep the image minimal – fewer packages, fewer CVEs. Production isn’t just “it works on my machine.” It’s about reducing attack surface before someone else finds it. Multi-stage + Non-root + Minimal image = Production-ready container. #Python #Docker #DevSecOps #CloudSecurity #Kubernetes #SecurityByDesign
To view or add a comment, sign in
-
🚀 Docker Image Optimization: 1.07GB → 58MB A small change in your Dockerfile can make a massive difference in image size and performance. Instead of building everything in one large image, use Multi-Stage Builds. 🔴 The Problem (Bloated Image – 1.07GB) Using a full Ubuntu image and installing everything in a single stage adds unnecessary packages and build tools to the final container. 🟢 The Solution (Optimized Image – 58MB) Use a builder stage to install dependencies and compile packages, then copy only the required artifacts into a lightweight runtime image. Benefits: ✅ Smaller image size ✅ Faster builds & deployments ✅ Reduced attack surface ✅ Lower storage and bandwidth usage 💡 Key Idea: Build heavy dependencies in the builder stage, ship only what you need in the final stage. This simple pattern is one of the easiest ways to improve your containerized applications. What’s the biggest Docker image size you’ve optimized so far? 👇 #Docker #DevOps #CloudNative #SoftwareEngineering #BackendDevelopment #Python #Containers
To view or add a comment, sign in
-
-
"𝐅𝐢𝐧𝐚𝐥𝐥𝐲 𝐛𝐮𝐢𝐥𝐭 𝐭𝐡𝐞 𝐭𝐨𝐨𝐥 𝐞𝐯𝐞𝐫𝐲 𝐝𝐞𝐯𝐞𝐥𝐨𝐩𝐞𝐫 𝐬𝐞𝐜𝐫𝐞𝐭𝐥𝐲 𝐰𝐚𝐧𝐭𝐬." 👀 A small CLI that runs your Python script, reads the stack trace, checks the git history, and prints a Root Cause Analysis like this. Basically… When the code breaks, it politely tells who last touched that line. 😄 Just a small fun experiment using logs + git blame and some AI. #python #git #developerhumor #devtools #programming #softwareengineering
To view or add a comment, sign in
-
-
Built a Personal Library Manager with Python + Streamlit! First 32s: Full code walkthrough (main.py + pyproject.toml) Last 33s: Live UI demo (Add books, Search, Stats, Export) Features: - Add books with Title, Author, Genre, Year, Pages - Inline editing with Read/Unread checkbox - Search by Title or Author instantly - Stats dashboard with genre bar chart - Export your entire library to CSV - Zero database needed - saves locally as CSV - No login, no cloud - 100% private Built with Python + Streamlit + Pandas + uv 106 lines of code. Zero backend. Works offline. This is the kind of tool I use personally - simple, fast, no unnecessary complexity. #Python #Streamlit #Pandas #BuildInPublic #100DaysOfCode #TechPakistan #Programming #OpenSource
Personal Library Manager - Python + Streamlit
To view or add a comment, sign in
-
𝗠𝘆 𝗗𝗼𝗰𝗸𝗲𝗿 𝗶𝗺𝗮𝗴𝗲 𝘄𝗮𝘀 𝟭.𝟮𝗚𝗕. 𝗡𝗼𝘄 𝗶𝘁 𝗶𝘀 𝟴𝟬𝗠𝗕. The difference? I stopped shipping my compiler to production. In my early builds, I just used 𝘍𝘙𝘖𝘔 𝘱𝘺𝘵𝘩𝘰𝘯:3.9 and installed everything. The result: A bloated container carrying GCC, build headers, and cache files that the runtime never needed. Here is the pattern that changed my deployment speed: 𝗠𝘂𝗹𝘁𝗶-𝗦𝘁𝗮𝗴𝗲 𝗕𝘂𝗶𝗹𝗱𝘀 𝗦𝘁𝗮𝗴𝗲 𝟭 (𝗕𝘂𝗶𝗹𝗱𝗲𝗿): Install heavy dependencies. Compile binaries. Build wheels. 𝗦𝘁𝗮𝗴𝗲 𝟮 (𝗥𝘂𝗻𝗻𝗲𝗿): Copy only the artifacts from Stage 1 into a slim 𝘢𝘭𝘱𝘪𝘯𝘦 or 𝘥𝘪𝘴𝘵𝘳𝘰𝘭𝘦𝘴𝘴 image. Small images = Faster pulls = Faster scale-outs. 𝗜𝗳 𝘆𝗼𝘂𝗿 𝗽𝗿𝗼𝗱𝘂𝗰𝘁𝗶𝗼𝗻 𝗰𝗼𝗻𝘁𝗮𝗶𝗻𝗲𝗿 𝗵𝗮𝘀 𝘨𝘪𝘵 𝗼𝗿 𝘨𝘤𝘤 𝗶𝗻𝘀𝘁𝗮𝗹𝗹𝗲𝗱, 𝗶𝘁’𝘀 𝘁𝗼𝗼 𝗵𝗲𝗮𝘃𝘆. #Docker #DevOps #CloudOptimization #Containerization #Python #ShreyasTech
To view or add a comment, sign in
-
-
The only Python tool you need in 2026? 🐍 The Python ecosystem has been fragmented for years. We used pyenv for versions, venv for isolation, pip for packages, and pip-tools for locking. uv changes everything. Here is your quick command guide: 📦 Start a project: uv init ➕ Add a library: uv add requests 🏃 Run a script: uv run main.py 🐍 Install Python 3.13: uv python install 3.13 🛠 Run a tool (like Ruff): uvx ruff check It’s a drop-in replacement for pip, so you can even use uv pip install -r requirements.txt for an immediate speed boost. The Verdict: If you value your time, uv is a non-negotiable upgrade to your workflow. #PythonProgramming #CodingTips #DevOps #BackendDevelopment #uvPython
To view or add a comment, sign in
-
🚀 Most Python APIs fail because of performance and scalability - not code. After building and optimizing multiple backend systems, I realized many developers struggle with the same FastAPI mistakes. So I wrote a complete 2026 guide on building high-performance Python APIs with FastAPI - covering: ✅ Clean project structure ✅ Async best practices ✅ Authentication & security ✅ Performance optimization ✅ Production deployment ✅ Real-world examples If you’re serious about building APIs that scale, this will save you months of trial and error. 📖 Read it here: 👉 https://lnkd.in/gyW8RtRV What’s the biggest challenge you face with APIs right now? Let’s discuss 👇💬 #Python #FastAPI #BackendDevelopment #WebDevelopment #APIs #SoftwareEngineering #TechBlog
To view or add a comment, sign in
-
-
Inside docker, we may not want these logs to show. So we'll make an environmental variable to control this. https://lnkd.in/e844m76x #python #streamlit #crossfit #tutorial #datascience #softwaredevelopment #software #fastapi #contextmanager #logging #docker
To view or add a comment, sign in
-
-
Dockerfiles Are Runtime Contracts A Dockerfile isn’t just a file that builds an image. It defines the exact conditions under which your application is allowed to run. That makes it a contract. If you write: FROM python:latest you’re saying: “I’m okay with my runtime changing without me noticing.” If you don’t pin versions, you’re accepting silent upgrades If you copy everything blindly, you’re accepting unnecessary size and risk If you run as root, you’re expanding your attack surface. A good Dockerfile answers three questions clearly: • What exact environment does this app need? • What does it not need? • Can this run the same way tomorrow as it does today? Containers don’t guarantee stability Clear contracts do. #docker #softwareengineering
To view or add a comment, sign in
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development