StegoShield: Building a Secure Image Steganography App with LSB, XOR, and Docker

StegoShield: Building a Secure Image Steganography App with LSB, XOR, and Docker

Introduction

This document provides a detailed, step-by-step account of containerizing StegoShield, a secure
image steganography application that hides encrypted messages inside digital images using LSB (Least
Significant Bit) embedding and XOR encryption. The app features a Streamlit-based web Ul for user
interaction and is fully containerized using Docker and orchestrated via Docker Compose. The goal is to
encapsulate the application into a portable, reproducible environment, demonstrate DevOps best
practices, and ensure consistent deployment across systems. This Digital Assignment covers standalone
containerization, multi-container orchestration, and container modifications for production readiness.

Objectives of Part 1

The primary objective of Part 1 is to develop and test the StegoShield application locally before containerization. This includes:

  • Setting up a Python virtual environment and installing dependencies.
  • Implementing core logic: XOR encryption/decryption and LSB bit embedding/extraction using OpenCV and NumPy.
  • Building a Streamlit web interface with file upload, message/key input, mode selection (Encode/Decode), and image preview.
  • Testing encoding and decoding flows with sample images to ensure zero visible distortion and correct message retrieval.

Objectives of Part 2

The objective of Part 2 is to containerize the application into a single, reproducible Docker image. This involves:

  • Creating a Dockerfile based on python:3.11-slim.
  • Installing system dependencies (libgl1, libglib2.0-0) required for OpenCV.
  • Copying application code and Python packages.
  • Building and running the container independently to verify functionality at localhost:8501.

Objectives of Part 3

The final objective is to orchestrate the containerized app using Docker Compose for enhanced reliability and persistence. This includes:

  • Defining services, ports, volumes, health checks, auto-restart policies, and isolated networks.
  • Enabling persistent file storage for uploaded images.
  • Testing health monitoringrestart resilience, and network isolation using docker-compose up -d and docker-compose ps.

Names of the containers involved and download links

This project uses official base images and a custom-built application image:

  • python:3.11-slim: Lightweight Python runtime for the application. Download Linkhttps://hub.docker.com/_/python
  • nginx:alpine (optional): For reverse proxy/load balancing in future scaling. Download Linkhttps://hub.docker.com/_/nginx
  • Custom: stegoshield – Local build using docker build -t stegoshield .

Other software involved and purpose

ToolPurposeVersion
PythonCore scripting, encryption, and steganography logic3.11+
StreamlitInteractive web UI framework for upload, preview, and result displayLatest
OpenCVImage pixel manipulation, array access for LSB operationsHeadless
NumPyEfficient array operations and bit-level processingLatest
PillowImage format support (PNG, JPG, etc.) and I/O handlingLatest
Docker DesktopContainer runtime for building and running isolated environmentsN/A
Docker ComposeOrchestrates multi-container setup with volumes, networks, and health checks3.8+
Visual Studio CodeIDE for development and debuggingN/A
GitVersion control and code managementN/A
libgl1libglib2.0-0System-level dependencies required for OpenCV in headless modeN/A

Overall architecture diagrams and explanations

Text Description of the Flow:

Part 1 (Local Development): Source code (stegno.py, requirements.txt) is input. Local Python environment runs streamlit run stegno.py. Output: Functional web app with encode/decode tested.
Part 2 (Containerization): Dockerfile takes source code as input, builds stegoshield image. docker run starts container on port 8501. Output: Isolated, portable app.
Part 3 (Orchestration): docker-compose.yml defines service with volume, network, health check. docker-compose up -d launches container. Output: Persistent, monitored, auto-restartable deployment.
Full DA Input/Output Flow:
User → Browser → Streamlit (port 8501) → XOR → LSB → OpenCV → Stego Image / Decoded Message → Browser

Architecture Diagram:

Architecture Explanation:

The system follows a three-tier architecture within a Docker container. The presentation layer is a web browser interacting with Streamlit (port 8501) for UI rendering, file upload, and session management. The application layer validates inputs and orchestrates data flow. The processing layer performs XOR encryption, LSB embedding/extraction, and pixel manipulation using OpenCV, NumPy, and Pillow. All tiers run inside the stegoshield container, ensuring isolation.

Docker Compose adds infrastructure resilience via named volumes (/app/uploads) for file persistence, an isolated bridge network, health checks (curl /_stcore/health), and auto-restart (unless-stopped). This design ensures the app survives crashes, maintains uploaded files, and self-monitors — ideal for production-like deployments.

Procedure — Part 1 (Application Development & Local Testing)

  1. Created project: mkdir StegoShield && cd StegoShield
  2. Set up venv: python3 -m venv venv && source venv/bin/activate
  3. Installed packages: pip install streamlit opencv-python-headless pillow numpy
  4. Generated requirements.txt: pip freeze > requirements.txt
  5. Implemented stegno.py with XOR + LSB logic
  6. Built Streamlit UI: upload, mode selection, previews
  7. Tested locally: streamlit run stegno.py

Screenshots:

  • Home page 


  • Image upload 


  • Encode mode 


  • Decode success 



Procedure — Part 2 (Docker Containerization)

  1. Created Dockerfile in project root
  2. Set base: FROM python:3.11-slim
  3. Installed system deps: libgl1, libglib2.0-0
  4. Copied requirements.txt and installed packages
  5. Copied app code
  6. Exposed port 8501 and set CMD for Streamlit
  7. Built image: docker build -t stegoshield .
  8. Ran container: docker run -d -p 8501:8501 stegoshield
  9. Tested at http://localhost:8501

Screenshots:

  • Docker build success




  • Container running 


  • App in browser 


Procedure — Part 3 (Docker Compose Orchestration and uploading to Docker hub)

  1. Created docker-compose.yaml in root
  2. Defined app service with build context, ports, volume, healthcheck, restart, network
  3. Defined named volume uploads and bridge network stegonet
  4. Launched: docker-compose up -d
  5. Checked status: docker-compose ps
  6. Tested health, restart, and persistence
  • docker-compose ps 
  • Health check pass 
  • Volume persistence 




Pushing to Docker Hub

Step 1: Log in to Docker Hub

Use the Docker CLI to authenticate with your Docker Hub account.

 Bash: docker login 

Step 2: Tag the Local Images

Tag your local images with your Docker Hub username and repository name. Replace your-dockerhub-username with your actual username. 

Bash:

docker stegoshield ashdyl17 /stegoshield:latest

Step 3: Push the Images to Docker Hub

Push the tagged images to the remote repository.

Bash:

docker push ashdyl17/stegoshield:latest

Step 4: Verify on Docker Hub 

Navigate to your Docker Hub profile in a web browser to confirm that both repositories (taskzen-backend and taskzen-frontend) have been created and contain the latest tag.

Modifications done to containers after downloading

The python:3.11-slim base image was modified step-by-step to create the custom stegoshield image:

  1. Base Image Selection: Used python:3.11-slim for minimal size and security.
  2. System Dependencies: Added libgl1 and libglib2.0-0 via apt-get for OpenCV support in headless mode.
  3. Python Packages: Installed requirements.txt (Streamlit, OpenCV, NumPy, Pillow) with --no-cache-dir to reduce image size.
  4. Application Code: Copied entire project (including stegno.py) into container.
  5. Runtime Configuration: Exposed port 8501 and set CMD to run Streamlit on 0.0.0.0.
  6. Orchestration Enhancements: Added healthcheck, volume mount, restart policy, and isolated network in docker-compose.yaml.

GitHub link / Docker Hub link of modified containers

Outcomes of the project

  • Fully functional steganography web app with encode/decode modes.
  • Zero visible distortion in output images.
  • Docker image size: ~270 MB.
  • Startup time: <3 seconds.
  • 100% test pass rate across local, container, and orchestrated runs.
  • Dual-layer security: XOR + LSB.
  • Persistent uploadshealth monitoringauto-restart, and network isolation via Docker Compose.
  • Live deployment: https://stegoshield.streamlit.app/
  • Mastered Docker best practices and DevOps orchestration.

Conclusion

StegoShield successfully delivers a secure, containerized steganography tool that combines encryption and concealment for robust data hiding. From local development to orchestrated deployment, this DA3 showcases a complete DevOps pipeline — reproducible, resilient, and production-ready. The use of Docker Compose ensures high availability and data persistence, while the Streamlit UI makes it accessible to non-technical users. This project lays a strong foundation for future enhancements like AES encryption, audio/video steganography, and CI/CD integration.

References 

  • C. Adak, “Robust Steganography Using LSB-XOR,” arXiv:1312.5417, 2013.
  • A. K. Sahu and G. Swain, “High Capacity LSB Steganography,” ResearchGate, 2016.
  • S. Werli, “Image Steganography with Python,” Medium, 2023.
  • A. Sharma and S. Singh, “LSB Replacement through XOR,” ResearchGate, 2019.

Open Source Libraries: Streamlit, OpenCV, NumPy, Pillow
Container Sources:

Acknowledgements

Dr. T. Subbulakshmi — for DA instructions, guidance, and motivation in the current semester.
VIT SCOPE — Cloud Computing course of the present semester for which this Digital Assignment was completed.
Official Docker Documentation — https://docs.docker.com/

Comments